]> granicus.if.org Git - pgbadger/commitdiff
Fix parsing of remote file that was failing when the file does not exists locally...
authorGilles Darold <gilles.darold@dalibo.com>
Thu, 18 Aug 2016 13:46:32 +0000 (15:46 +0200)
committerGilles Darold <gilles.darold@dalibo.com>
Thu, 18 Aug 2016 13:46:32 +0000 (15:46 +0200)
pgbadger

index 0819f62ab16469ea760ae4c6948e2d0696080841..b7a2733b16f9aa0f3d7fc3b4bdd63f8331aa35b1 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -1391,7 +1391,12 @@ if ( ($#given_log_files >= 0) && (($queue_size > 1) || ($job_per_file > 1)) ) {
                }
 
                # Get log format of the current file
-               my $fmt = &autodetect_format($logfile);
+               my $fmt = $format || 'stderr';
+               if (!$remote_host && !$journalctl_cmd) {
+                       $fmt = &autodetect_format($logfile);
+               } else {
+                       &logmsg('DEBUG', "Can not autodetect log format, assuming $fmt.");
+               }
 
                # Set regex to parse the log file
                set_parser_regex($fmt);
@@ -1470,7 +1475,12 @@ if ( ($#given_log_files >= 0) && (($queue_size > 1) || ($job_per_file > 1)) ) {
        foreach my $logfile ( @given_log_files ) {
 
                # Get log format of the current file
-               my $fmt = autodetect_format($logfile);
+               my $fmt = $format || 'stderr';
+               if (!$remote_host && !$journalctl_cmd) {
+                       $fmt = &autodetect_format($logfile);
+               } else {
+                       &logmsg('DEBUG', "Can not autodetect log format, assuming $fmt.");
+               }
 
                # Set regex to parse the log file 
                set_parser_regex($fmt);