5

monitor new logs

view full story
linux-howto

http://www.unix.com – I would like to monitor logfile for specific keyword and send email once detected. I'm trying out the code here, the script is scheduled to run every minute. Everytime it runs, the same log will be detected and send email. Anyway it can be improved to detect only new logs? tail -f /logfile | while read line ; do if [[ `echo $line | grep "keyword"` ]] then a="`echo $line | grep "keyword"`" echo $a "detected" email alert fi done (HowTos)