Friday, July 13, 2018

To setup a simple log monitoring script


// TODO


#! /bin/bash
echo "monitoring log files"
if grep SQLSTATE application-cronjob-*-`date +"%Y-%m-%d"`.log ;
then
    echo "sending mail"
    grep -10 SQLSTATE application-cronjob-*-`date +"%Y-%m-%d"`.log | mail -s "errors found in  logs for `date +"%Y-%m-%d"` example@example.com
fi

No comments:

Post a Comment

Latest Posts