summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorN0YB <Al_Stu@Frontier.com>2012-12-07 02:46:32 -0800
committerN0YB <Al_Stu@Frontier.com>2012-12-07 02:46:32 -0800
commitcd8155b1c1381831d83b1da92f4904a8c3fd51cc (patch)
tree3c4bafca12a195f4d45d365688532543d623168e
parentcbeed539364ca124c0f99f902ccfeb918cf0129c (diff)
downloadpfsense-cd8155b1c1381831d83b1da92f4904a8c3fd51cc.zip
pfsense-cd8155b1c1381831d83b1da92f4904a8c3fd51cc.tar.gz
Update etc/inc/filter_log.inc
Firewall Logs Widget FilteringOptions to filter on interfaces, 'pass', 'block', & 'reject'
-rw-r--r--etc/inc/filter_log.inc16
1 files changed, 15 insertions, 1 deletions
diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc
index 3e06058..d989fa1 100644
--- a/etc/inc/filter_log.inc
+++ b/etc/inc/filter_log.inc
@@ -71,7 +71,8 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil
$flent = parse_filter_line($logent);
if (!$filterinterface || ($filterinterface == $flent['interface']))
{
- if (($flent != "") && (match_filter_line($flent, $filtertext))) {
+ if ( ( ($flent != "") && (!is_array($filtertext)) && (match_filter_line ($flent, $filtertext))) ||
+ ( ($flent != "") && ( is_array($filtertext)) && (match_filter_field($flent, $filtertext)) ) ) {
$counter++;
$filterlog[] = $flent;
}
@@ -88,6 +89,19 @@ function match_filter_line($flent, $filtertext = "") {
return preg_match("/{$filtertext}/i", implode(" ", array_values($flent)));
}
+function match_filter_field($flent, $fields) {
+ foreach ($fields as $field) {
+ if ($fields[$field] == "All") continue;
+ if ( !(in_arrayi($flent[$field], explode(",", str_replace(" ", ",", $fields[$field]))) ) ) return false;
+ }
+ return true;
+}
+
+// Case Insensitive in_array function
+function in_arrayi($needle, $haystack) {
+ return in_array(strtolower($needle), array_map('strtolower', $haystack));
+}
+
function collapse_filter_lines($logarr) {
$lastline = "";
$collapsed = array();
OpenPOWER on IntegriCloud