All Apps and Add-ons

Alarm for tomcat service

fsrodriguez
New Member

I have set up an alarm to tell me when tomcat service is down.

hosts="server" source="ps" tomcat | stats latest(_time) as latest by host

That is what I have for my search. For the trigger I have set: search < 1.

Sometimes I get false alarms. Am I missing something?

Also at my job they used /var/logs directory... shouldn't we just use some tomcat directory just to monitor tomcat?

Thanks in advance!

0 Karma

nickhills
Ultra Champion

Tomcat can be installed in many ways, and whilst you are correct that the 'normal' location is /var/log/tomcat/catalina.out often this is symlinked to somewhere else such as /usr/share/tomcat8/log/catalina.out As long as you have the correct sourcetypes set for the inputs, I wouldn't worry about the paths too much unless its also your job to manage the servers and it bothers you.

In your query above you are monitoring the tomcat process from ps which from time to time (depending on config) may choose to restart itself (or crash and restart) whilst both of these are events you may be interested in, I have found that monitoring the catalina.out file over an x minute period provides a better indication of when the process stop because the log file approach is more forgiving of restarted processes.
It also would highlight if tomcat 'hangs'. In such a situation the process might still be running, but not servicing requests. This latter approach would catch that.

If my comment helps, please give it a thumbs up!
0 Karma

fsrodriguez
New Member

ah ok! yeah that makes a lot of sense just to monitor the catalina.out file. Are you using "ps" ? I have it to check every 5 minutes. Would you mind sharing your query?

I'm wondering if there is an alternative method to check other than running PS.

0 Karma

nickhills
Ultra Champion

Yes, I tend to monitor the tomcat sourcetype - since a running tomcat server is frequently writing logs (even when idle) I have found this a better method rather than ps.

that way even if tomcat hangs (as ours did from time to time) the lack of catalina logs is more telling than a running process in ps.

If my comment helps, please give it a thumbs up!
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...