From 23bc29551c817dea75c4cd6ecb6d34db64eaa78b Mon Sep 17 00:00:00 2001 From: Darold Gilles Date: Mon, 10 Mar 2014 16:46:37 +0100 Subject: [PATCH] Fix additional message at end of query or error when it was logged from application output. Thanks to Herve Werner for the report. --- pgbadger | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pgbadger b/pgbadger index 562e4bd..d264460 100755 --- a/pgbadger +++ b/pgbadger @@ -1690,6 +1690,9 @@ sub process_file next; } + # Some log line may be written by applications + next if ($line =~ / LOG: /); + if (exists $cur_temp_info{$cur_pid}{query}) { $cur_temp_info{$cur_pid}{query} .= "\n" . $t_query; } elsif (exists $cur_lock_info{$cur_pid}{query}) { @@ -1707,6 +1710,9 @@ sub process_file # Collect orphaned lines of multiline queries } elsif ($cur_pid && ($line !~ $orphan_syslog_line)) { + # Some log line may be written by applications + next if ($line =~ / LOG: /); + if (exists $cur_temp_info{$cur_pid}{query}) { $cur_temp_info{$cur_pid}{query} .= "\n" . $line; } elsif (exists $cur_lock_info{$cur_pid}{query}) { @@ -1810,6 +1816,10 @@ sub process_file $cur_info{$cur_pid}{parameters} .= " $line"; next; } + + # Some log line may be written by applications + next if ($line =~ / LOG: /); + if (exists $cur_temp_info{$cur_pid}{query}) { $cur_temp_info{$cur_pid}{query} .= "\n" . $line; } elsif (exists $cur_lock_info{$cur_pid}{query}) { -- 2.50.1