From: Darold Gilles Date: Wed, 24 Feb 2016 15:23:50 +0000 (+0100) Subject: Fix a major issue introduced with support to pgbouncer that prevent parsing of compre... X-Git-Tag: v8.1~11^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06c405fb9d1efc9235cd4ffb416371684f110029;p=pgbadger Fix a major issue introduced with support to pgbouncer that prevent parsing of compressed PostgreSQL log files. Thanks to Levente Birta for the report. --- diff --git a/pgbadger b/pgbadger index 4a45ba0..5dd1823 100755 --- a/pgbadger +++ b/pgbadger @@ -3045,9 +3045,7 @@ sub detect_pgbouncer_log # Compressed files do not allow seeking if ($iscompressed) { - close($lfile); - return (1, "log file is compressed"); - + $look_at_beginning = 1; } my ($gsec, $gmin, $ghour, $gmday, $gmon, $gyear, $gwday, $gyday, $gisdst) = localtime(time); @@ -3081,8 +3079,11 @@ sub detect_pgbouncer_log } } next if (!$prefix_vars{'t_timestamp'}); + if ($iscompressed) { + close($lfile); + return ($ispgbouncerlog, 0, "log file is compressed start at offset 0"); # This file has already been parsed - if ($saved_date gt $prefix_vars{'t_timestamp'}) { + } elsif ($saved_date gt $prefix_vars{'t_timestamp'}) { close($lfile); return ($ispgbouncerlog, 0, "timestamp $prefix_vars{'t_timestamp'} read at offset $startoffset is lower than saved timestamp: $saved_date"); } else {