Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
share|improve this question

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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