Skip to Content

Routing Drupal System Messages Using the Syslog Module

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".
  6. Setup logrotate. This will keep a few days worth of logs available so that the server disk does not get filled up with log files.
    1. sudo cp /etc/logrotate.d/syslog /etc/logrotate.d/yourdomain
      • replace 'yourdomain' with something that identifies your VPS
    2. sudo nano /etc/logrotate.d/vpsname
    3. replace the first line of the file with:
      • /var/log/yourdomain.log {
      • (Keep the end curly bracket.)

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