Can i get email notification each time error_log added/increased?

Discussion in 'Site & Server Administration' started by basketmen, Mar 26, 2012.

  1. #1
    Each time our site got error messages, is stored in a file, called error_log, in ftp right?

    i wonder can i get notification to email each time new error message added/increased?
     
    basketmen, Mar 26, 2012 IP
  2. samirj09

    samirj09 Well-Known Member

    Messages:
    335
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    125
    #2
    it shouldn't be too hard to create a shell script that runs on a cron job to do that.

    Something like the below should work.

    lines=`cat LOCATIONOFERRORLOG | wc -l`
    if [ $lines -gt CURRENTNUMBEROFLINES ]
    then
    echo New Error
    fi


    Wrote it up really quick so not perfect, should work the first time, then you will need to manually increase the number of lines. It would be better to incorporate a lock file that increases this to pull the variable from.

    Let me know if you need help on this or if it works for you.
     
    samirj09, Mar 26, 2012 IP