]> granicus.if.org Git - pgbadger/commitdiff
Fix escaping of log_line_prefix . Thanks to Hubert Depesz Lubaczewski for the patch.
authorDarold Gilles <gilles@darold.net>
Thu, 18 Oct 2012 20:50:39 +0000 (22:50 +0200)
committerDarold Gilles <gilles@darold.net>
Thu, 18 Oct 2012 20:50:39 +0000 (22:50 +0200)
pgbadger

index 52b9af8440e6a6dfd9a2ec8da6c5aaff126bbdf5..d8d076a8cd6d92e2a4aad67632d1417fa94ad376 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -294,7 +294,6 @@ my $orphan_stderr_line = qr/[^']*\d+-\d+-\d+\s\d+:\d+:\d+[\.\d]*\s[^\s]+[^']*/;
 # Compile custom log line prefie prefix
 my @prefix_params = ();
 if ($log_line_prefix) {
-        $log_line_prefix =~ s/([\[\]\|\/])/\\$1/g;
        @prefix_params = &build_log_line_prefix_regex();
        &check_regex($log_line_prefix, '--prefix');
        if ($format eq 'syslog') {
@@ -4059,6 +4058,7 @@ sub build_log_line_prefix_regex
                '%e' => [ ('t_sqlstate', '([0-9a-zA-Z]+)') ], # SQL state
        );
        my @param_list = ();
+        $log_line_prefix =~ s/([\[\]\|\(\)\{\}])/\\$1/g;
        $log_line_prefix =~ s/\%l([^\d])\d+/\%l$1\\d\+/;
        while ($log_line_prefix =~ s/(\%[audrhptmlscvxie])/$regex_map{"$1"}->[1]/) {
                push(@param_list, $regex_map{"$1"}->[0]);