I need to make a script to get certain errors from Tomcat log or maybe get them before Tomcat prints the erros to catalina.out. After getting error X, Y or Z, I want it to run a certain command, like sendmail. What methods I could use to achieve this?
I know I can tail -f catalina.out to see it in real time, but I'm not sure if I can make a script to monitor this.
I'm using CentOS 7.5 along with Tomcat 7.2.