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.

  • 1
    Searching for something like linux log watcher will turn up several solutions in the first few links. Have you tried any of these yet? – doneal24 Nov 14 '18 at 19:26
  • you could make a file watcher in Perl with some good modules reading logs in real time and triggering actions – olivierg Nov 14 '18 at 20:09
  • I found a program called sec. I'm testing it now. Thanks! – Mateus Scheper Nov 16 '18 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.