[Nagiosplug-devel] [ nagiosplug-Patches-1025841 ] fixes for check_log
SourceForge.net
noreply at sourceforge.net
Fri Sep 10 06:07:01 CEST 2004
Patches item #1025841, was opened at 2004-09-10 15:06
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1025841&group_id=29880
Category: Bugfix
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Richard Luys (luys)
Assigned to: Nobody/Anonymous (nobody)
Summary: fixes for check_log
Initial Comment:
In my humble opinion (backed up by first-hand
experience), the check_log script is not yet complete.
When the logfile to check becomes empty (for instance
after logrotate or a reboot), the 'older copy of the logfile'
still contains data. Since these files are compared with a
diff-statement: diff $logfile $oldlog, all lines in the oldlog
will be checked for a match with the given query-string,
resulting in a lot of notifications.
The way I solved it, is as follows:
instead of diff $logfile $oldlog, I use diff $logfile $oldlog |
grep \^\<
This results in diff outputting ONLY NEW lines in the
logfile. If the logfile becomes empty, all diff-output lines
start with '>' and will not be checked.
This is probably a quick-and-dirty solution, but works fine
for us (so far)...
Another issue I found in this script:
lastentry=`$GREP "$query" $tempdiff | $TAIL -lines=1`
I am not sure which Os'es understand tail -lines=1 but
afaik tail -1 is more common...
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1025841&group_id=29880
More information about the Devel
mailing list