Page 1 of 1

check_logfiles with report=long, how to limit to recent only

Posted: Wed Sep 25, 2019 12:39 pm
by avonnieda
Hi folks,

I'm using check_logfiles v3.11.0.2 with "$options = 'report=long';". when it finds an error, instead of it just showing the errors since the last time the service was "OK", it shows all of the errors that match. Here's an example scenario ..

Check 1: OK
<New error goes to he log - "Connection refused 1"
Check 2: Displays the error in the long output
Connection refused 1
Check 3: OK
<New error goes to he log - "Connection refused 2"
Check 4: Displays both of the errors instead of just the new one.
Connection refused 1
Connection refused 2

So basically if my log file has 250 errors in it, I'm going to see them all from the plugin each time a new error occurs. That seems weird.

Is there a way to have it just show me the errors that have occurred since the last time the service was "OK"? Am i just being too picky?

Here's my config file

Code: Select all

$options = 'report=long';
@searches = (
  {
    tag => 'mpac_http',
    logfile => '/var/log/httpd/mpac_8888_ssl_error_log',
    criticalpatterns => [
        '.*Connection refused.*',
        '.*Cannot serve directory.*'
    ],
  });
Thanks!

-Adam

Re: check_logfiles with report=long, how to limit to recent

Posted: Wed Sep 25, 2019 12:49 pm
by scottwilkerson
This is not our plugin, but according to the help
$options = A list of options which control the influence of pre- and postscript. Known options are smartpostscript, supersmartpostscript, smartprescript and supersmartprescript. With the option report=”short|long|html” you can customize the plugin’s output. With report=long/html, the plugin’s output can possibly become very long. By default it will be truncated to 4096 characters (The amount of data an unpatched Nagios is able to process). The option maxlength can be used to raise this limit, e.g. maxlength=8192. The option seekfileerror defines the errorlevel, if a seekfile cannot be written, e.g. seekfileerror=unknown (default:critical). The same applies to protocolfileerror (default: ok). Usually the last error message will be shown in the first line of the output. With preview=5 you can tell check_logfiles to show for example the last 5 hits. (default is: preview=1)
https://labs.consol.de/nagios/check_logfiles/index.html

I would suggest directing additional inquiries at the plugins author as they may have better insight

Re: check_logfiles with report=long, how to limit to recent

Posted: Wed Sep 25, 2019 3:09 pm
by avonnieda
Roger that, thanks for the response. I was able to modify "check_log" to do exactly what I was looking for.

-Adam

Re: check_logfiles with report=long, how to limit to recent

Posted: Wed Sep 25, 2019 3:15 pm
by scottwilkerson
avonnieda wrote:Roger that, thanks for the response. I was able to modify "check_log" to do exactly what I was looking for.

-Adam
Great!

Locking thread