0

We use swatch for reading PHP logs and email them to us. Currently it emails one single line of the error, but fails to match the next few lines of stack trace.

For example: for log file like this:

..
Line1: PHP Fatal error: something bad happened in /php/files/whoami.php
Line2: PHP Stack trace: 
Line3: PHP     1. more info about the error above
Line4: PHP     2. still more info about the error above
Line5: PHP     3. still still more info about the error above
Line6: PHP Fatal error: something bad happened in /php/files/whoareyou.php
..

It emails line 1 and then line 6. I want to get the information about next lines in the same email as line 1. [one more problem is that the stacktrace lines can be anywhere from 0 to 6]

swatch conf line:

watchfor /(PHP Fatal error: .*)/i 
mail addresses=macmon\@mydomain.com,subject="Errors" threshold=on threshold track_by=$1,type=limit,count=1,seconds=5
0

I found this in my search for a similar problem.. I think LogSurfer is another tool that does it a bit 'cleaner' with contexts..

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.