From: Darold Gilles Date: Mon, 24 Dec 2012 09:31:49 +0000 (+0100) Subject: Remove duration from log format auto-detection. Thanks to Guillaume Lelarge for the... X-Git-Tag: v3.2~80 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d59e8b62b25fd40df4c48253030076d8100a572e;p=pgbadger Remove duration from log format auto-detection. Thanks to Guillaume Lelarge for the report. --- diff --git a/pgbadger b/pgbadger index aa2b4d4..f0c477c 100755 --- a/pgbadger +++ b/pgbadger @@ -4418,10 +4418,6 @@ sub autodetect_format } else { # try to detect syslogs or csv my ($tfile, $totalsize) = &open_log_file($file); - my $duration = 'duration:'; - if ($error_only || ($disable_hourly && $disable_query)) { - $duration = ''; - } my %ident_name = (); while (my $line = <$tfile>) { chomp($line); @@ -4431,7 +4427,7 @@ sub autodetect_format # Are syslog lines ? if ($line =~ - /^[A-Z][a-z]{2}\s+\d+\s\d+:\d+:\d+(?:\s[^\s]+)?\s[^\s]+\s([^\s\[]+)\[\d+\]:(?:\s\[[^\]]+\])?\s\[\d+\-\d+\].*?(LOG|WARNING|ERROR|FATAL|PANIC|DETAIL|STATEMENT|HINT|CONTEXT):\s+$duration/ + /^[A-Z][a-z]{2}\s+\d+\s\d+:\d+:\d+(?:\s[^\s]+)?\s[^\s]+\s([^\s\[]+)\[\d+\]:(?:\s\[[^\]]+\])?\s\[\d+\-\d+\].*?(LOG|WARNING|ERROR|FATAL|PANIC|DETAIL|STATEMENT|HINT|CONTEXT):/ ) { $fmt = 'syslog'; @@ -4450,7 +4446,7 @@ sub autodetect_format $fmt = 'csv'; $nfound++; } elsif ($line =~ - /\d+-\d+-\d+ \d+:\d+:\d+[\.0-9]*(?: [A-Z\d]{3,6})?(.*?)(LOG|WARNING|ERROR|FATAL|PANIC|DETAIL|STATEMENT|HINT|CONTEXT):\s+$duration/ + /\d+-\d+-\d+ \d+:\d+:\d+[\.0-9]*(?: [A-Z\d]{3,6})?(.*?)(LOG|WARNING|ERROR|FATAL|PANIC|DETAIL|STATEMENT|HINT|CONTEXT):\s+/ ) { $fmt = 'stderr';