Disable cron log on syslog and enable cron.log

By default, Ubuntu logs all cron activity directly to syslog (/var/log/syslog), instead to a dedicated file like /var/log/cron.log.

In my opinion, it is best to keep them separate if you have several cron jobs running on your server.

To enable this behavior, what we must do is edit the syslog configuration file /etc/syslog.conf, and modify the following lines:

  • Change *.*;auth,authpriv.none with *.*;auth,authpriv,cron.none, this will avoid the messages to be recorded on the syslog file.
  • Uncomment (removing the # character) the line starting cron.*, this will record the messages to the specified file on that line.

Then, we need to restart the syslog service, doing the following:

$ sudo /etc/init.d/sysklogd restart

And maybe, restarting the cron service also:

$ sudo /etc/init.d/cron restart

Sources: this and this.

Leave a Reply

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

Are you human? *

This site uses Akismet to reduce spam. Learn how your comment data is processed.