diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-09-27 23:09:43 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-09-27 23:09:43 +0000 |
commit | a0e4bd9f2b4751142f588bd63d9828f8f2710411 (patch) | |
tree | baa1fbb546b7dcf48cf5e9daac0114505f55672c /usr | |
parent | 0fcfdd3d0bac7b2c8b7ba4d98d82d1deac1cd606 (diff) | |
download | pfsense-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')
-rwxr-xr-x | usr/local/www/guiconfig.inc | 14 |
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) { |