I'm trying to create a shell script that would look for ERROR
inside of /var/log/jbossas/standalone/server.log
, such as following:
# grep ERROR /var/log/jbossas/standalone/server.log
10:36:37,530 ERROR [class X] (ajp-/192.168.X.X:8009-20) THIS IS A TEST
#
script will be executed via cron
, so it must look for error within certain time frame only, otherwise there could be duplicate emails every time it executes.
this is my current solution to this:
# crontab -l
@hourly grep ERROR /var/log/jbossas/standalone/server.log | grep `date +%H --date="1 hour ago"`
#
unfortunately this solution limits me to run on hourly bases only.
I thought I'd ask question here and see if I can find better solution then mine.