From: Gilles Darold Date: Fri, 8 Feb 2019 07:42:30 +0000 (+0100) Subject: Fix autodetection of log file with "non standard" log line prefix. If X-Git-Tag: v10.3~5^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5dcc6740e23fb1f2dd5d45f13bfbfe77b502cb17;p=pgbadger Fix autodetection of log file with "non standard" log line prefix. If --prefix specify %t | %m | %n and %p or %c, set format to stderr. Thanks to Alex Danvy for the report. --- diff --git a/pgbadger b/pgbadger index 7ebd36c..b8c6c8a 100755 --- 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