15-Feb-2021 06:29
We are having Tomcat memory issues on multiple F5 devices. We need to create a python script to analyze logs on multiple devices and find if there is a log "java.lang.OutOfMemoryError: " in /var/log/tomcat/catalina.out. Could someone please help me draft this script.
15-Feb-2021 06:58
Dont you have a centralized logging, like splunk, syslog servers. I'm sure there will be.
Simply use splunk or your monitoring tool to search for the OOM log
18-Feb-2021
14:12
- last edited on
04-Jun-2023
21:02
by
JimmyPackets
If I do not want to use an external logging service, I am in a hurry, and my boxes have adequate power and bandwidth, I would use iControl REST POST /mgmt/tm/util/bash to call "cat <file> | grep keywords". Run this against all the boxes one by one.
$ curl -sku $PASS https://$HOST/mgmt/tm/util/bash \
-X POST -H "Content-type: application/json" \
-d '{"command":"run", "utilCmdArgs": "-c \"cat /var/log/tomcat/catalina.out | grep \\\"Unknown version\\\"\""}' \
| jq -r '.commandResult'
WARNING: Unknown version string [3.1]. Default version will be used.
(I chose "Unknow version" for grepping as my log presently does not have OutOfMemoryError".)
I chose jq for parsing. You can do the same using python, of course. Be careful with the double escaping for double-quotes. We can easily make mistakes (For the above call, I tried three times :-).
For a sophisticated method for deploying logging facility, check F5 Telemetry Streaming.