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!
- 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.
- Restart the syslog daemon:
sudo /sbin/service syslog restart- Make sure you have the Syslog module enabled under Administer (top menu) » Site building » Modules.
- Click Administer (top menu) » Site configuration » Logging and alerts » Syslog.
- Choose LOG_LOCAL0 - Local 0, then click "Save configuration".
- 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.
sudo cp /etc/logrotate.d/syslog /etc/logrotate.d/yourdomain- replace 'yourdomain' with something that identifies your VPS
sudo nano /etc/logrotate.d/vpsname- 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:
