From af85efec3afa12c7b623d0f32ca4ed8f5797d903 Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 20 Mar 2019 16:19:57 -0400 Subject: [PATCH] Fix empty log files in the GUI. Fixes #9415 Two ways they were empty that I found: * filterlog log entries now have a pid after the process * CARP/VRRP entries did not set a source and so were not logged While here, add CARP details to proto field of GUI log view. --- src/etc/inc/filter_log.inc | 6 ++++-- src/usr/local/www/status_logs_filter.php | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/etc/inc/filter_log.inc b/src/etc/inc/filter_log.inc index a08fda12c1..f294b006a9 100644 --- a/src/etc/inc/filter_log.inc +++ b/src/etc/inc/filter_log.inc @@ -83,7 +83,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil # Construct RegEx for specific log file type. if ($logfile_type == 'firewall') { - $pattern = "filterlog:"; + $pattern = "filterlog"; } else if ($logfile_type == 'system') { $pattern = "^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $process_pid_pattern . "\ +" . $log_message_pattern . "$"; @@ -303,7 +303,7 @@ function parse_firewall_log_line($line) { $flent = array(); $log_split = ""; - if (!preg_match("/(.*)\s(.*)\sfilterlog:\s(.*)$/", $line, $log_split)) { + if (!preg_match("/(.*)\s(.*)\sfilterlog\[[0-9]+\]:\s(.*)$/", $line, $log_split)) { return ""; } @@ -419,6 +419,8 @@ function parse_firewall_log_line($line) { $flent['version'] = $rule_data[$field++]; $flent['advskew'] = $rule_data[$field++]; $flent['advbase'] = $rule_data[$field++]; + $flent['src'] = $flent['srcip']; + $flent['dst'] = $flent['dstip']; } } else { if ($g['debug']) { diff --git a/src/usr/local/www/status_logs_filter.php b/src/usr/local/www/status_logs_filter.php index d26f848e4d..395c388ccc 100644 --- a/src/usr/local/www/status_logs_filter.php +++ b/src/usr/local/www/status_logs_filter.php @@ -251,6 +251,20 @@ if (!$rawfilter) {