If you own a shared hosting server, you probably want to keep the /var/log/messages file as clean as possible, to make searching for errors as easy as possible.
One of our web servers had a messages file filled with Drupal errors and warnings. It al seemed to come from one site.
After a bit of searching, it seemed the syslog module in Drupal was enabled. There are two solutions to this annoyance. You can disable the syslog module in the database used by this site, or make syslog log all Drupal errors to a separate file.
Database solution
The most easy method to check and disable the syslog module is disabling this module in the database as follows:
Checking if the module is enabled:
SELECT * FROM system WHERE name='syslog';
If the status column is 0, the module is disabled, in case of a 1 the module is enabled.
To disable the module:
UPDATE system SET status='0' WHERE name='syslog';
And to check if the module is really disabled:
SELECT * FROM system WHERE name='syslog';
The status column should now say 0.
Separate log solution
Create the file /etc/rsyslog.d/90-drupal.conf with the following content, depending on your version of rsyslog.
For rsyslog < v7:
# drupal logging
if $programname == ‘drupal’ and $syslogseverity <= '6' then /var/log/drupal.log
if $programname == 'drupal' and $syslogseverity <= '6' then ~
For rsyslog >= v7:
# drupal logging
if $programname == 'drupal' and $syslogseverity <= '6' then /var/log/drupal.log
if $programname == 'drupal' and $syslogseverity <= '6' then end
That's it. There should be no more Drupal messages in the /var/log/messages file.