Question

I am new to Stackoverflow. So kindly pardon me if i have not made my homework of searching thoroughly. I have a problem in parsing text from tomcat localhost log and catalina.out file. We all know that we receive SEVERE alerts in either of these files. I want a script or free software which will help me to parse the SEVERE alerts alone and mail to my email.

For Example:

SEVERE: Error listenerStart
6 Jul, 2012 2:04:40 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [**********] startup failed due to previous errors
6 Jul, 2012 2:04:40 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc

SEVERE: The web application [**************] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
6 Jul, 2012 2:04:40 PM org.apache.catalina.startup.HostConfig deployWAR

INFO: Deploying web application archive server.war
6 Jul, 2012 2:04:40 PM org.apache.catalina.loader.WebappClassLoader validateJarFile

The script must parse from "SEVERE:...." to the text till next "SEVERE:...." or the end of the file. The script can be in shell or python or ruby.

Was it helpful?

Solution

Seriously?

What's wrong with bash script like:

grep ^SEVERE catalina.out | mail foo@bar.com

Snapshot requirement? Try this:

grep ^SEVERE catalina.out > tmpFile
diff tmpFile snapshot | mail foo@bar.com
mv tmpFile snapshot
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top