Alert for error in logs

Issue #761 new
Former user created an issue

I am trying to enable alerts on the monit dashboard whenever there is an error in a log file. Giving the below line shows that the log file is accessible but does not alert if the file contains the word "error".

check file accesstest with path /usr/local/nginx/logs/accesstest
    if match 'error' then alert

How can this line be changed so that the dashboard shows when an error occurs.

Comments (2)

  1. Tildeslash repo owner

    When the content test matched, the error flag is set for until the test is performed again (next cycle).

    Monit records the file position and the next cycle checks only content, which was appended since the last cycle - except if the file shrunk or the inode changed, then the content match seeks to the beginning of the file.

    If your monitoring cycle is short and the error is spurious, it is very likely it popped up in the dashboard just for short time and was reset the next cycle.

  2. Log in to comment