From: Darold Gilles Date: Mon, 14 Apr 2014 17:23:23 +0000 (+0200) Subject: Fix wrong connections per host count. Thanks to Herve Werner for the report. X-Git-Tag: v5.1~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b8fdb034deee474f7841dcc49595f4286dd1349;p=pgbadger Fix wrong connections per host count. Thanks to Herve Werner for the report. --- diff --git a/pgbadger b/pgbadger index a4395ad..b8234a9 100644 --- a/pgbadger +++ b/pgbadger @@ -4148,8 +4148,8 @@ sub print_host_connection

Key values

@@ -8284,9 +8284,8 @@ sub parse_query } # Stores pre-connection activity - if (($prefix_vars{'t_loglevel'} eq 'LOG') && ($prefix_vars{'t_query'} =~ /connection received: host=([^\s]+) port=(\d+)/)) { + if (($prefix_vars{'t_loglevel'} eq 'LOG') && ($prefix_vars{'t_query'} =~ /connection received: host=([^\s]+)(?: port=(\d+))?/)) { return if ($disable_connection); - $current_sessions{$prefix_vars{'t_pid'}} = 1; $conn_received{$t_pid} = $1; return; } @@ -8307,6 +8306,8 @@ sub parse_query } if ($prefix_vars{'t_query'} =~ / host=([^\s]+)/) { $host = $1; + } elsif ($prefix_vars{'t_client'}) { + $host = $prefix_vars{'t_client'}; } if ($extension eq 'tsung') { $tsung_session{$prefix_vars{'t_pid'}}{connection}{database} = $db; @@ -8335,12 +8336,11 @@ sub parse_query } if (exists $conn_received{$t_pid}) { $connection_info{host}{$conn_received{$t_pid}}++; - #$connection_info{chronos}{$date_part}{$prefix_vars{'t_hour'}}{host}{$conn_received{$t_pid}}++; delete $conn_received{$t_pid}; } elsif ($host) { $connection_info{host}{$host}++; - #$connection_info{chronos}{$date_part}{$prefix_vars{'t_hour'}}{host}{$host}++; } + return; }