From: Gilles Darold Date: Fri, 9 Sep 2016 10:35:00 +0000 (+0200) Subject: Fix support to %r placeholder in prefix instead of %h. X-Git-Tag: v9.1~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a3ad6dc04eeb4179eda0ef346284929e75ba0b6;p=pgbadger Fix support to %r placeholder in prefix instead of %h. --- diff --git a/pgbadger b/pgbadger index efce67e..af8386d 100644 --- a/pgbadger +++ b/pgbadger @@ -2746,6 +2746,12 @@ sub process_file $prefix_vars{'t_timestamp'} = "$prefix_vars{'t_year'}-$prefix_vars{'t_month'}-$prefix_vars{'t_day'} $prefix_vars{'t_hour'}:$prefix_vars{'t_min'}:$prefix_vars{'t_sec'}"; + if ($prefix_vars{'t_hostport'} && !$prefix_vars{'t_client'}) { + $prefix_vars{'t_client'} = $prefix_vars{'t_hostport'}; + # Remove the port part + $prefix_vars{'t_client'} =~ s/\(.*//; + } + # Skip unwanted lines if ($#exclude_time >= 0) { foreach (@exclude_time) { @@ -2855,6 +2861,12 @@ sub process_file ($prefix_vars{'t_year'}, $prefix_vars{'t_month'}, $prefix_vars{'t_day'}, $prefix_vars{'t_hour'}, $prefix_vars{'t_min'}, $prefix_vars{'t_sec'}) = ($prefix_vars{'t_timestamp'} =~ $time_pattern); + if ($prefix_vars{'t_hostport'} && !$prefix_vars{'t_client'}) { + $prefix_vars{'t_client'} = $prefix_vars{'t_hostport'}; + # Remove the port part + $prefix_vars{'t_client'} =~ s/\(.*//; + } + # Skip unwanted lines if ($#exclude_time >= 0) { foreach (@exclude_time) {