Need some guidance
Monitor a application log file(log rotation is daily)using tail-f, if exception in log file need to send alert using script.
Need some guidance
Monitor a application log file(log rotation is daily)using tail-f, if exception in log file need to send alert using script.
It's hard to build a log monitor with just tail -f
. tail
does have a +c
option to read from a particular position, but it would be tricky to build good code around it.
What you need is this:
seek
) and does pattern matching and notification based on the lines read, and updates the read control fileThe above script could either run as a daemon or execute periodically as a cron job. I would strongly suggest using Perl, Ruby, Python, or even Java/C/C++ for this.