diff options
author | Colin Smith <colin@pfsense.org> | 2005-04-06 01:11:03 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-04-06 01:11:03 +0000 |
commit | cbca24721d771c523c394798e8b31f5cf04d6a1e (patch) | |
tree | f609ed123a80e3affcd439325ef432b4a6883850 /usr/local/www/guiconfig.inc | |
parent | c669ba562c3ac7fcb1024202dbd3980c3a2f59b3 (diff) | |
download | pfsense-cbca24721d771c523c394798e8b31f5cf04d6a1e.zip pfsense-cbca24721d771c523c394798e8b31f5cf04d6a1e.tar.gz |
Support multiple "grep" statements. This should really be replaced by a preg_match or equivalent.
Diffstat (limited to 'usr/local/www/guiconfig.inc')
-rwxr-xr-x | usr/local/www/guiconfig.inc | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index cf592fe..4108ff9 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -458,15 +458,30 @@ function dump_clog($logfile, $tail, $grepfor = "", $grepinvert = false, $withori $sor = isset($config['syslog']['reverse']) ? "-r" : ""; if($grepfor <> "") { - if($grepinvert == true) { - exec("/usr/sbin/clog {$logfile} | /usr/bin/grep -v {$grepfor} | /usr/bin/tail {$sor} -n {$tail}", $logarr); - } else { - exec("/usr/sbin/clog {$logfile} | /usr/bin/grep {$grepfor} | /usr/bin/tail {$sor} -n {$tail}", $logarr); - } + $size = count($grepfor); + foreach($grepfor as $agrep) { + if($grepinvert[$size - count($grepfor)] == true) { + if($size > 1) { + $grep .= "grep -v {$agrep} | "; + } else { + $grep .= "grep -v {$agrep}"; + } + $size--; + } else { + if($size > 1) { + $grep .= "grep {$agrep} | "; + } else { + $grep .= "grep {$agrep}"; + } + $size--; + } + } + exec("/usr/sbin/clog {$logfile} | {$grep} | /usr/bin/tail {$sor} -n {$tail}", $logarr); } else { exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n {$tail}", $logarr); } foreach ($logarr as $logent) { + print $logent[0]; $logent = preg_split("/\s+/", $logent, 6); echo "<tr valign=\"top\">\n"; |