Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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\,subject="Errors" threshold=on threshold track_by=$1,type=limit,count=1,seconds=5
share|improve this question

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


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.