Posts Tagged ‘separately’

How to enable cron log separately in cron.log in Debian GNU / Linux

Thursday, October 4th, 2012

Default logging mechanism in and rest of its forks Ubuntu, Xubuntu whatever is done that there is no separate logging for cron daemon (/usr/sbin/cron). Instead all output messages from cron service gets logged in /var/log/auth.log

I don’t like this and since I ever remember using Linux I always liked it whether cron logs its activities in /var/log/cron.log.

Hence on each and every new Desktop or Server install, one of my first things is to set crond log msg separately in /var/log/cron.log.

In older Debians syslog, was used whether in Debian Squeeze, (Wheezy) and onwards releases rsyslog is used.

On hosts depending on syslogd or rsyslogd to manage logs, to enable cron.log just uncomment in either /etc/syslog.conf or /etc/rsyslog.conf:


# cron.* /var/log/cron.log


cron.* /var/log/cron.log

Create cron.log


linux:~# touch /var/log/cron.log

And restart syslogd / rsyslogd and cron


linux:~# /etc/init.d/rsyslogd restart
Stopping enhanced syslogd: rsyslogd.
Starting enhanced syslogd: rsyslogd.
linux:~# /etc/init.d/cron restart
Restarting periodic command scheduler: cron.
....

Check cron.log to see it logs fine:


linux:~# tail -n 5 /var/log/cron.log
Oct 4 16:31:27 pcfreak /usr/sbin/cron[32413]: (CRON) STARTUP (fork ok)
Oct 4 16:31:27 pcfreak /usr/sbin/cron[32413]: (CRON) INFO
(Skipping @reboot jobs -- not system startup)
Oct 4 16:32:35 pcfreak /usr/sbin/cron[32468]: (CRON) INFO
(pidfile fd = 3)
Oct 4 16:32:35 pcfreak /usr/sbin/cron[32469]: (CRON) STARTUP
(fork ok)
Oct 4 16:32:35 pcfreak /usr/sbin/cron[32469]: (CRON) INFO
(Skipping @reboot jobs -- not system startup)