Re: Monitor log file thru shell script
Date: Wed, 9 Jul 2008 09:31:16 -0500 (CDT)
I'm curious -- can you give examples of non "ORA-" issues you've had in your alert.log that were worthy of notification? Always looking to improve on log checking! :)
Unlike any other logchecker I've seen, my perl script checks *all* log and trace files in the $ORACLE_BASE tree. There are many places errors can popup that aren't recorded in the alert.log, especially with middle tiers, Grid Control, and the like.
To preemptively strike the obvious question about this process, I minimize the IO overhead by keeping track of the last known filesize of each log/trace file. If the size hasn't changed, don't recheck. If it has, sysseek to the last size and start searching there. Granted, it still relies heavily on FS caching, but running this every minute via cron takes only about 1 second if it doesn't find errors and max 3 seconds if it found multiples (which is most likely due to the overhead in mailing the found errors). This is true for both our production IBM 8-way p-series w/32GB RAM and SAN as well as the spartan P-IV desktop we use for Grid Control.
It works well for me, exceeding the timliness and thoroughness of Grid Control monitoring.
> I do not trust grep "whatever error strings" alert_SID.log; because new
errors may be not reported to me.
> I wrote a simple PERL program to report all/any lines not contained in an
> It runs via cron every 5 minutes & starts reporting from the timestamp
where it last ended.