summaryrefslogtreecommitdiffstats
path: root/usr/local/www/guiconfig.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-09-27 23:09:43 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-09-27 23:09:43 +0000
commita0e4bd9f2b4751142f588bd63d9828f8f2710411 (patch)
treebaa1fbb546b7dcf48cf5e9daac0114505f55672c /usr/local/www/guiconfig.inc
parent0fcfdd3d0bac7b2c8b7ba4d98d82d1deac1cd606 (diff)
downloadpfsense-a0e4bd9f2b4751142f588bd63d9828f8f2710411.zip
pfsense-a0e4bd9f2b4751142f588bd63d9828f8f2710411.tar.gz
We cannot tail the initial clog file in return_clog because we are not guaranteed to have that amount of "matching" lines. Instead, build up a grepline that contains all of the grep and grep -v statement. This now allows the tail to chop off the last X lines correctly.
Diffstat (limited to 'usr/local/www/guiconfig.inc')
-rwxr-xr-xusr/local/www/guiconfig.inc14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index d3ed496..b4fd385 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -594,8 +594,18 @@ function return_clog($logfile, $tail, $grepfor = "", $grepinvert = "", $grepreve
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
$sor = isset($grepreverse) ? "-r" : "";
$logarr = "";
- exec("/usr/sbin/clog {$logfile} | grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
-
+ $grepline = " ";
+ if(is_array($grepfor)) {
+ foreach($grepfor as $agrep) {
+ $regexp = $agrep;
+ if($grepinvert[$i]) {
+ $grepline .= " | grep \"$regexp\"";
+ } else {
+ $grepline .= " | grep -v \"$regexp\"";
+ }
+ }
+ }
+ exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
if(is_array($grepfor)) {
$i = 0;
foreach($grepfor as $agrep) {
OpenPOWER on IntegriCloud