Drupal7 Module – Logging and Alerts

I have a Drupal based webapp that is open for a segment of time during the school quarter. My confidence is high there are few logic, or data integrity issues with the site at the point … but I’d like extra assurances that if an error occurs on the site I’m notified ASAP.

Recently I found the Logging and Alerts module for Drupal 7. There are many similar modules for Drupal 7/6. But this one I know is maintained in part by core developers and is solid at version 2.2 for Drupal 7. It seems slim and having been using it in production over the weekend, it’s OK for my needs.

The logging and alerts module allows you to (taken from the module project page):

  • Email logging and alerts
    Allows routing of watchdog messages to various email addresses, based on their severity levels. For example, emergency and critical messages need to go to a pager or mobile phone email address, while debug messages go nowhere.
  • Web server logging
    Allows routing of watchdog messages to the web server’s error log. Note that what is in your PHP configuration for error_log defines where the message will go. For example, on a UNIX like system, this will be syslog(3), which may end up in /var/log/apache2/error.log, and on Windows, it would be the event log. You define which severity levels are to go to the error log. For example, you can only specify that emergency and critical messages need to go to the error log, and use other modules for the other levels.
  • Watchdog triggers
    Provides a trigger for watchdog events. You may now trigger actions when an event occurs.
  • Watchdog rules
    Provides rules integration for watchdog events. You may now trigger additional ruleset responses when an event occurs.

I have used this on my site to notify of these events on the site, with the following configuration for this module:

Email Address configuration per error indication

Email Address configuration per error indication

Categories of informational data to include in the email body.

Categories of informational data to include in the email body.

In doing so I get an email such as the following information:

subject: [] Warning: student/my-surveys/submission/286309

body:

Site:           https://myapplication.example/
Severity:       Warning (4)
Timestamp:      2014-05-25 22:37:24
Type:           access denied
IP Address:     128.111.138.37
Request URI:    https://myapplication.example/student/my-surveys/submission/286309
Referrer URI:
User:           Anonymous (0)
Link:
Message:

student/my-surveys/submission/286309


$_REQUEST => Array
(
)

$_SESSION => Array
(
)

debug_backtrace() => Array
(
     [0] => Array
         (
             [file] =>
/var/www/app/htdocs/sites/all/modules/logging_alerts/emaillog/emaillog.module
             [line] => 115
             [function] => eval
         )

     [1] => Array
         (
             [function] => emaillog_watchdog
             [args] => array(11)
         )

    # ... More debug stacktrace here ...

)

The subject and body of the email are designed essentially for developer usage. They simply tell me the severity of the problem and a small look at the state of the system when the error occurred.

I haven’t had any huge issues — but it’s very useful diagnostic info with very little setup or worry of breaking my application by enabling it! I highly recommend this simple, powerful module.

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , | Posted under Drupal | RSS 2.0

Author Spotlight

David Gurba

David Gurba

I am a web programmer currently employed at UCSB. I have been developing web applications professionally for 8+ years now. For the last 5 years I’ve been actively developing websites primarily in PHP using Drupal. I have experience using LAMP and developing data driven websites for clients in aviation, higher education and e-commerce. If you’d like to contact me I can be reached at david.gurba@arvixe.com

Leave a Reply

Your email address will not be published. Required fields are marked *


9 − 1 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>