How best to monitor and alert on the absence of an event in the logs

alertsmonitoringscriptingsyslog-ng

With logs getting captured in syslog-ng, I'd like to be able to automatically monitor the logs and receive an alert if NO log events appear that match a certain criteria. For instance, for a subscription-based website, if 6 hours elapse with no orders, then email or text this person or group of people.

What is a good way to do that?

Best Answer

http://labs.consol.de/nagios/check_logfiles is a Nagios plugin which is used to monitor logfiles. Usually you check, if there is a certain pattern (error message). But it's alos possible to reverse this. For example, if you run check_logfiles --logfile /var/log/mybackup.log --criticalpattern '!backup succeeded' every morning, you will get an alert if there was no 'backup succeeded' message entry since the last run of check_logfiles.

Gerhard