System log - ignore messages



  • Is it possible to ignore specific messages being logged?



  • Not really.  The Settings page allows you to not log some events.  A better solution for you might be to log everything to an external syslog server and then filter from there.



  • What's being logged that you want to ignore?



  • @cmb:

    What's being logged that you want to ignore?

    The error messages from this thread, although I made a patch as a bandaid fix:

    --- /usr/local/www/diag_logs.php
    +++ /usr/local/www/diag_logs.php
    @@ -108,15 +108,15 @@
    
     					if($filtertext)
    -						dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp"));
    +						dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp|sa6_recoverscope"));
     					else
    -						dump_clog($system_logfile, $nentries, true, array(), array("ppp"));
    +						dump_clog($system_logfile, $nentries, true, array(), array("ppp|sa6_recoverscope"));
     				?>
    
     					  | 				 				 				
    
    <form id="filterform" name="filterform" action="diag_logs.php" method="post" style="margin-top: 14px;">
                   				" />
     						</form>
    
    Maybe a new field can be put beside the "Filter" field (on diag_logs.php) for dump_clog's "$grepinvert". |
    
    


  • Think the advanced log filtering in 2.3 will allow that to be filtered out (excluded).



  • Something like this should allow search to be inverted by preceding the search term with an exclamation point as the first character.

    That way it can be used for anything rather than a hard coded string.

    
    --- /usr/local/www/guiconfig.inc
    +++ /usr/local/www/guiconfig.inc
    @@ -603,13 +603,17 @@
     function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
     	global $g, $config;
     	$sor = isset($config['syslog']['reverse']) ? "-r" : "";
     	$logarr = "";
     	$grepline = "  ";
     	if(is_array($grepfor))
    +		if ((strpos($grepfor[0], '!') === 0)) {
    +			$grepfor[0] = substr($grepfor[0], 1);
    +			$invert = '-v';
    +		}
    -		$grepline .= " | /usr/bin/egrep " . escapeshellarg(implode("|", $grepfor));
    +		$grepline .= " | /usr/bin/egrep $invert " . escapeshellarg(implode("|", $grepfor));
     	if(is_array($grepinvert))
     		$grepline .= " | /usr/bin/egrep -v " . escapeshellarg(implode("|", $grepinvert));
     	if (is_dir($logfile)) {
     		$logarr = array("File $logfile is a directory.");
     	} elseif (file_exists($logfile) && filesize($logfile) == 0) {
     		$logarr = array("Log file started.");
    
    


  • Thanks, I'll add that one too.


Log in to reply