bash – get real-time bugs from the Tomcat log

I need to create a script to get or possibly get certain errors from the Tomcat log In front Tomcat prints the bugs on catalina.out. After getting errors X, Y, or Z, I want a specific command to be executed, such as sendmail,
With which methods could I achieve this?

I know I can Tail -f Catalina.out to see it in real time, but I'm not sure if I can create a script to monitor it.

I am using CentOS 7.5 together with Tomcat 7.2.