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
Stewie
  • 537
  • 2
  • 7
  • 17

1 Answers1

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..

Brian
  • 1,213
  • 2
  • 14
  • 24