From 00aab3df527055ecf90f14e2a4b99b391e9f2b37 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 10 Mar 2005 01:14:10 +0000 Subject: Really correctly output correct number of records chosen on "pretty" rules mode --- usr/local/www/diag_logs_filter.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php index f301389..6e463e7 100755 --- a/usr/local/www/diag_logs_filter.php +++ b/usr/local/www/diag_logs_filter.php @@ -67,6 +67,10 @@ function dump_clog($logfile, $tail, $withorig = true) { function conv_clog($logfile, $tail) { global $g, $config; + $nentries = $config['syslog']['nentries']; + if (!$nentries) + $nentries = 50; + /* make interface/port table */ $iftable = array(); $iftable[$config['interfaces']['lan']['if']] = "LAN"; @@ -76,7 +80,7 @@ function conv_clog($logfile, $tail) { $sor = isset($config['syslog']['reverse']) ? "-r" : ""; - exec("/usr/sbin/clog " . $logfile . " | tail {$sor} -n " . $tail, $logarr); + exec("/usr/sbin/clog " . $logfile . " | tail {$sor} -n 250000", $logarr); $filterlog = array(); @@ -115,11 +119,14 @@ function conv_clog($logfile, $tail) { if($flent['proto'] == "S" or $flent['proto'] == "NBT" or $flent['proto'] == "." or $flent['proto'] == "R" or $flent['proto'] == ">") $dontdisplay = 1; - if($dontdisplay == 0) + if($dontdisplay == 0) { $filterlog[] = $flent; - if($counter > $nentries) - break; + if($counter > $nentries) + return $filterlog; + + $counter++; + } } return $filterlog; -- cgit v1.1