S
snoopy_
Hello,
I am looking for a way to look at a log from the last time I've read
it and look for a specific string. For example, I have a logfile
called /var/adm/messages, and I am looking for an error string like
"ERROR: Loss of sync"
I know how to open the log and search for the error, but I want to
avoid reporting the same error multiple times. For instance, if I find
an error at 01:00 AM and send a page to a support team, when the
program/script runs every 10 minutes, I don't want to page again if I
already alerted for it.
In the past I would catch the error and place it in a temp file, I
would then check for the indeticle line log in a log.page file. If
they were the same I already alerted for it and would do nothing. If
it was differnt I would append this error to the log.page file and
would send out a page/alert.
I know there are logwatcher programs that can read fro EOF (End of
file) or EOR (End of Read). How can I do this in something like Perl,
sh/ksh/csh scripting, or Java? The program will be running on a unix
system.
Any suggestions would be appreciated. Thanks.
I am looking for a way to look at a log from the last time I've read
it and look for a specific string. For example, I have a logfile
called /var/adm/messages, and I am looking for an error string like
"ERROR: Loss of sync"
I know how to open the log and search for the error, but I want to
avoid reporting the same error multiple times. For instance, if I find
an error at 01:00 AM and send a page to a support team, when the
program/script runs every 10 minutes, I don't want to page again if I
already alerted for it.
In the past I would catch the error and place it in a temp file, I
would then check for the indeticle line log in a log.page file. If
they were the same I already alerted for it and would do nothing. If
it was differnt I would append this error to the log.page file and
would send out a page/alert.
I know there are logwatcher programs that can read fro EOF (End of
file) or EOR (End of Read). How can I do this in something like Perl,
sh/ksh/csh scripting, or Java? The program will be running on a unix
system.
Any suggestions would be appreciated. Thanks.