scoutapp/scout-plugins — pull request #144 by wormzer (2014-02-27 18:38:21+00:00)
Title: Log watcher fixes for rotation and empty file cases

(note, use ?w=1 for the diff to ignore some indentation changes)

1) using inode to detect rotation and track down rotated copy to resume scanning (one more pass)
2) fixed "first time" issues where occurrence on first line was ignored
3) reports count=0 while file doesn't exist (and send_error_if_no_log == "0")

I realize this is a pretty big change so consider it carefully. There were some definite bugs in the "first time" case missing entries. If you have an occurrence on the first line of a file, those were undetected, for example. I don't have the same problems with these changes. I've tested this out pretty well and am going to install it as a private plugin for testing.

I set up something yesterday that is designed to just look for the word P2 in a log file that normally doesn't exist. So then, if I append a "P2" on the end of the log a P2 alert will be generated. This was not working very well with the current public plugin so I investigated.

Some of the patterns you see below are from my previous dealing with the messiness of log rotation (like the inode trick).