Project

General

Profile

« Previous | Next » 

Revision a0e4bd9f

Added by Scott Ullrich almost 19 years ago

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.

View differences:

usr/local/www/guiconfig.inc
594 594
	$sor = isset($config['syslog']['reverse']) ? "-r" : "";
595 595
	$sor = isset($grepreverse) ? "-r" : "";
596 596
	$logarr = "";
597
	exec("/usr/sbin/clog {$logfile} | grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
598

  
597
	$grepline = "  ";
598
	if(is_array($grepfor)) {
599
		 foreach($grepfor as $agrep) {
600
	         $regexp = $agrep;
601
             if($grepinvert[$i]) {
602
                     $grepline .= " | grep \"$regexp\"";
603
             } else {
604
                     $grepline .= " | grep -v \"$regexp\"";
605
             }
606
		}
607
    }
608
	exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
599 609
	if(is_array($grepfor)) {
600 610
		$i = 0;
601 611
		foreach($grepfor as $agrep) {

Also available in: Unified diff