I want to monitor my application's log file (running on Linux Tomcat) and alert the developer(via email) when a "java heap space - out of memory error" appears in logs. Are there any solutions out there?
Asked
Active
Viewed 689 times
-2
-
Is monitoring your application log file a requirement or are you open to other options? Tomcat exposes key metrics over JMX. You can consume those instead. – Trein Dec 06 '19 at 20:19
-
Thanks Trein.. Definitely open to other options. Do I need to install JMX on the server running Tomcat for this? Can we send emails from JMX for alerts? – may Dec 06 '19 at 21:14
1 Answers
0
If scanning the logs is not a requirement, JMX can be an alternative to that. Check this answer on how to programmatically access JVM JMX metrics. The next step is to implement some code that will periodically probe your MBean and send an email to you (something along these lines this) in case heap memory crosses a given threshold.

Trein
- 3,658
- 27
- 36