summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/etc/inc/filter_log.inc16
-rw-r--r--src/usr/local/www/status_logs_vpn.php33
2 files changed, 16 insertions, 33 deletions
diff --git a/src/etc/inc/filter_log.inc b/src/etc/inc/filter_log.inc
index cc8bd76..d216083 100644
--- a/src/etc/inc/filter_log.inc
+++ b/src/etc/inc/filter_log.inc
@@ -87,8 +87,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil
else if ($logfile == "{$g['varlog_path']}/ipsec.log") { $logfile_type = "system"; }
else if ($logfile == "{$g['varlog_path']}/ppp.log") { $logfile_type = "system"; }
-# Needs to be tested with a vpn.log file before enabling.
-# else if ($logfile == "{$g['varlog_path']}/vpn.log") { $logfile_type = "vpn_login"; }
+ else if ($logfile == "{$g['varlog_path']}/vpn.log") { $logfile_type = "vpn_login"; }
else if ($logfile == "{$g['varlog_path']}/poes.log") { $logfile_type = "vpn_service"; }
else if ($logfile == "{$g['varlog_path']}/l2tps.log") { $logfile_type = "vpn_service"; }
@@ -124,16 +123,13 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil
$pattern = "^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $process_pid_pattern . "\ +" . $log_message_pattern . "$";
}
-# Needs to be tested with a vpn.log file before enabling.
-# These regex patterns are nearly certain to be incorrect.
-/* else if ($logfile_type == 'vpn_login') {
+ else if ($logfile_type == 'vpn_login') {
$action_pattern = "\(.*?\)";
$type_pattern = "\(.*?\)";
$ip_address_pattern = "\(.*?\)";
$user_pattern = "\(.*?\)";
- $pattern = "^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $process_pid_pattern . "\ +" . $action_pattern . "\ +" . $type_pattern . "\ +" . $ip_address_pattern . "\ +" . $user_pattern . "$";
+ $pattern = "^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $process_pattern . "\ +" . $action_pattern . "\,\ *" . $type_pattern . "\,\ *" . $ip_address_pattern . "\,\ *" . $user_pattern . "$";
}
-*/
else if ($logfile_type == 'vpn_service') {
$type_pattern = "\(.*?\):";
$pid_pattern = "\(?:process\ +\([0-9:]*\)\)?";
@@ -170,8 +166,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil
if ($logfile_type == 'firewall') { $flent = parse_firewall_log_line($logent); }
else if ($logfile_type == 'system') { $flent = parse_system_log_line($logent); }
-# Needs to be tested with a vpn.log file before enabling.
-# else if ($logfile_type == 'vpn_login') { $flent = parse_vpn_login_log_line($logent); }
+ else if ($logfile_type == 'vpn_login') { $flent = parse_vpn_login_log_line($logent); }
else if ($logfile_type == 'vpn_service') { $flent = parse_vpn_service_log_line($logent); }
else if ($logfile_type == 'unknown') { $flent = parse_unknown_log_line($logent); }
else { $flent = array(); }
@@ -255,8 +250,7 @@ function parse_vpn_login_log_line($line) {
if (!preg_match($pattern, $line, $log_split))
return "";
-# Needs to be tested with a vpn.log file before enabling.
-# list($all, $flent['time'], $flent['host'], $flent['process'], $flent['pid'], $flent['action'], $flent['type'], $flent['ip_address'], $flent['user']) = $log_split;
+ list($all, $flent['time'], $flent['host'], $flent['process'], $flent['action'], $flent['type'], $flent['ip_address'], $flent['user']) = $log_split;
/* If there is time, action, user, and IP address fields, then the line should be usable/good */
if (!( (trim($flent['time']) == "") && (trim($flent['action']) == "") && (trim($flent['user']) == "") && (trim($flent['ip_address']) == "") )) {
diff --git a/src/usr/local/www/status_logs_vpn.php b/src/usr/local/www/status_logs_vpn.php
index 8c69998..17def8a 100644
--- a/src/usr/local/www/status_logs_vpn.php
+++ b/src/usr/local/www/status_logs_vpn.php
@@ -136,17 +136,14 @@ filter_form_vpn();
// Now the forms are complete we can draw the log table and its controls
if (!$rawfilter) {
- if ($logfile != "vpn") { # Needs to be tested with a vpn.log file before enabling.
- if ($filterlogentries_submit) {
- $filterlog = conv_log_filter($vpn_logfile, $nentries, $nentries + 100, $filterfieldsarray);
- } else {
- $filterlog = conv_log_filter($vpn_logfile, $nentries, $nentries + 100, $filtertext);
- }
+ if ($filterlogentries_submit) {
+ $filterlog = conv_log_filter($vpn_logfile, $nentries, $nentries + 100, $filterfieldsarray);
+ } else {
+ $filterlog = conv_log_filter($vpn_logfile, $nentries, $nentries + 100, $filtertext);
}
?>
<div class="panel panel-default">
-<?php if ($logfile != "vpn") { # Needs to be tested with a vpn.log file before enabling. ?>
<div class="panel-heading">
<h2 class="panel-title">
<?php
@@ -160,9 +157,6 @@ if (!$rawfilter) {
?>
</h2>
</div>
-<?php } else { ?>
- <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
-<?php } ?>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
@@ -179,8 +173,8 @@ if (!$rawfilter) {
</thead>
<tbody>
<?php
- if ($logfile != "vpn") { # Needs to be tested with a vpn.log file before enabling.
- foreach ($filterlog as $filterent) {
+ foreach ($filterlog as $filterent) {
+ if (preg_match('/' . $vpntype . '/', $filterent['type'])) {
?>
<tr class="text-nowrap">
<td>
@@ -188,9 +182,9 @@ if (!$rawfilter) {
</td>
<td>
<? if ($filterent['action'] == "login") { ?>
- <i class=\"fa fa-arrow-left\" alt=\"in\"></i>
+ <i class="fa fa-arrow-left" title="in"></i>
<? } else { ?>
- <i class=\"fa fa-arrow-right\" alt=\"out\"></i>
+ <i class="fa fa-arrow-right" title="out"></i>
<? } ?>
</td>
<td>
@@ -201,11 +195,8 @@ if (!$rawfilter) {
</td>
</tr>
<?php
- } // e-o-foreach
- } else { # Continue using dump clog function until tested with a vpn.log file.
- $rows = dump_clog_vpn($vpn_logfile, $nentries); // dump_clog_vpn provides all the need <td></td>/<tr></tr> tags
- if ($rows > 0) $filterlog[0] = '';
- }
+ }
+ } // e-o-foreach
?>
</tbody>
<?php
@@ -501,9 +492,7 @@ function filter_form_vpn() {
$group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . gettext('Regular expression reference') . '</a> ' . gettext('Precede with exclamation (!) to exclude match.'));
$section->add($group);
$form->add($section);
- if ($logfile != "vpn") { # Needs to be tested with a vpn.log file before enabling.
- print $form;
- }
+ print $form;
}
?>
OpenPOWER on IntegriCloud