Email alerts for PHP errors via SEC
Production systems should always have PHP’s display_errors disabled and log_errors enabled so errors are logged instead of displayed to users. Of course, you’ll want a to be notified when errors happen and that’s where a nifty tool called SEC (Simple Event Correlator) comes in. It’s not very sexy, but its incredibly powerful and can be used for all sorts of log watching tasks.
Here are some helpful guides for getting started:
At HipChat we use a config like the following to to monitor Apache’s error_log for PHP errors and send us emails:
Assuming you put this config in /etc/sec/apache.conf
you’d run:
Try writing a few of your own rules (the –debug flag is very helpful) or the examples in the tutorials above. SEC is incredibly powerful and can make complex monitoring tasks very simple.