Routing Drupal System Messages Using the Syslog Module

Richard Eriksson - July 31, 2007 - 15:01

VPS customers can have their Drupal system messages appear in either the database or a raw log file on their system, or both!

  1. edit the /etc/syslog.conf file and add a line for local0. The following line can go anywhere in the file, and has the following format:
    • local0.* /var/log/yourdomain.log
    • The first column is the routing (which you will match in your Drupal settings later in these instructions) and the second column is the filename. We recommend storing it in /var/log and naming the file something unique to the site you are logging for, replacing 'yourdomain.com' with your site's domain.
  2. Restart the syslog daemon:
    • sudo /sbin/service syslog restart
  3. Make sure you have the Syslog module enabled under Administer (top menu) » Site building » Modules.
  4. Click Administer (top menu) » Site configuration » Logging and alerts » Syslog.
  5. Choose LOG_LOCAL0 - Local 0, then click "Save configuration".

To view the log, type sudo tail /var/log/yourdomain.log -f --lines=1 This tells your system to view whatever happens to be the last line of the log at any given point in time. Here's what this looks like if you have a Terminal window open using the justagwailo.com as an example:

screenshot of justagwailo.com's syslog tail, with some test data
Creative Commons License

This work is licensed under a Creative Commons Attribution-Share Alike 2.5 License. This license applies to all text written by Bryght. All others retain full copyright to their text.