]> granicus.if.org Git - pgbadger/commitdiff
Fix support to %r placeholder in prefix instead of %h.
authorGilles Darold <gilles.darold@dalibo.com>
Fri, 9 Sep 2016 10:35:00 +0000 (12:35 +0200)
committerGilles Darold <gilles.darold@dalibo.com>
Fri, 9 Sep 2016 10:35:00 +0000 (12:35 +0200)
pgbadger

index efce67e4f274bc0c2c5ecc74c961902273462d12..af8386d57bd486ecc9f71c549abc0d2282620852 100644 (file)
--- 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) {