From: Darold Gilles Date: Thu, 18 Sep 2014 07:19:54 +0000 (+0200) Subject: Fix surge in sessions number report when an exclusion or inclusion option (dbname... X-Git-Tag: v6.1~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b07f2cdee98b2803828a28e6d6754210957581e;p=pgbadger Fix surge in sessions number report when an exclusion or inclusion option (dbname, user, appname, etc.) is used. Thanks to suyah for the report. --- diff --git a/pgbadger b/pgbadger index adecfed..753789e 100755 --- a/pgbadger +++ b/pgbadger @@ -8690,6 +8690,7 @@ sub validate_log_line # Log line does not match the required dbname if (!$prefix_vars{'t_dbname'} || !grep(/^$prefix_vars{'t_dbname'}$/i, @dbname)) { + delete $current_sessions{$prefix_vars{'t_pid'}}; return 0; } } @@ -8697,6 +8698,7 @@ sub validate_log_line # Log line does not match the required dbuser if (!$prefix_vars{'t_dbuser'} || !grep(/^$prefix_vars{'t_dbuser'}$/i, @dbuser)) { + delete $current_sessions{$prefix_vars{'t_pid'}}; return 0; } } @@ -8705,6 +8707,7 @@ sub validate_log_line # Log line does not match the required dbclient $prefix_vars{'t_client'} ||= $prefix_vars{'t_hostport'}; if (!$prefix_vars{'t_client'} || !grep(/^$prefix_vars{'t_client'}$/i, @dbclient)) { + delete $current_sessions{$prefix_vars{'t_pid'}}; return 0; } } @@ -8712,6 +8715,7 @@ sub validate_log_line # Log line does not match the required dbname if (!$prefix_vars{'t_appname'} || !grep(/^\Q$prefix_vars{'t_appname'}\E$/i, @dbappname)) { + delete $current_sessions{$prefix_vars{'t_pid'}}; return 0; } } @@ -8719,6 +8723,7 @@ sub validate_log_line # Log line matches the excluded dbuser if ($prefix_vars{'t_dbuser'} && grep(/^$prefix_vars{'t_dbuser'}$/i, @exclude_user)) { + delete $current_sessions{$prefix_vars{'t_pid'}}; return 0; } } @@ -8726,6 +8731,7 @@ sub validate_log_line # Log line matches the excluded appname if ($prefix_vars{'t_appname'} && grep(/^\Q$prefix_vars{'t_appname'}\E$/i, @exclude_appname)) { + delete $current_sessions{$prefix_vars{'t_pid'}}; return 0; } }