Tomcat Monitoring log file

Hi,

I ned to monitor the tomcat log file called "catalina.out" for "OutOfMemory" ,"java.sql.SQLException" and "Error" error.

the script should monitor this file (catalina.out) and send us the mail as soon as it finds the string "Out of memory" or "java.sql.SQLException" or "Error" in the file.

can anyone suggest me which is the best way to do this?

Thanks in advance

There are several log monitoring options available on the internet and sadly, most of them require some type of work. Your log monitoring endeavor can be significantly simplified if the log file you wish to monitor actually has date and timestamps in it...meaning, do the lines in the log contain some type of date and time?

if so, then,

  1. you can either write your own log monitoring script: this would take a lot of time and can be very messy. There are several scenarios to consider to ensure you are actually informed when the state of the log file and its contents changes or matches your specified criteria.

  2. you can grab programs off the internet that will attempt to monitor the log for you. the drawback to this (in my opinion) is that most of these programs require the installation of other applications or they require too much time to get accustom to. but if you need their names, here they are: swatch, splunk.

  3. i have nagios installed in my environment and i use a tool called logrobot. you can do a search for logrobot and see if that fits your need. as far as i know, it doesn't send emails..except only via Nagios. but i guess it can be configured to do so via cron if thats what you needed.

if you dont have timestamps in your log file, things can get very messy and i would leave this to other members of this forum to provide their suggestions for this type of situation.

If you have Nagios, you may want to read this article:

write one script to check your predefined errors...

it won't take much efforts....:slight_smile: