]> granicus.if.org Git - pgbadger/commitdiff
Fix autodetection of log file with "non standard" log line prefix. If
authorGilles Darold <gilles@darold.net>
Fri, 8 Feb 2019 07:42:30 +0000 (08:42 +0100)
committerGilles Darold <gilles@darold.net>
Fri, 8 Feb 2019 07:42:30 +0000 (08:42 +0100)
--prefix specify %t | %m | %n and %p or %c, set format to stderr. Thanks
to Alex Danvy for the report.

pgbadger

index 7ebd36c4545b3d6808a00bfa8aa7ad2cf9d3bb8b..b8c6c8aee56514939aada2acb93d2e473d38a508 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -14528,7 +14528,16 @@ sub autodetect_format
        {
                if (!$fmt || ($nfound < 10 && $fmt ne 'binary'))
                {
-                       localdie("FATAL: unable to detect log file format from $file, please use -f option.\n");
+                       if ($log_line_prefix =~ /\%(t|m|n).*\%(c|p)/)
+                       {
+                               # when log line prefix is set and have mandatory
+                               # placeholders we considere format is stderr
+                               $fmt = 'stderr';
+                       }
+                       else
+                       {
+                               localdie("FATAL: unable to detect log file format from $file, please use -f option.\n");
+                       }
                }
        }
        else