≡ Menu

Ubuntu Linux check cron log file error or messages in /var/log/cron.log file

I am trying to find errors or message for my cron job on Ubuntu Linux server. Where is the cron log in Ubuntu Linux 12.04/14.04 LTS server? How do I check cron logs in Ubuntu server? How to check if crond server is enabled and/or is running properly on Ubuntu Linux server?

You can use the following command to check crond and cron logs.

Is crond (cron server) running?

Use the pgrep or ps command as follows to verify that crond is running:

pgrep cron
ps aux | grep cron
sudo service cron status
sudo status cron

Sample outputs:

Fig.01: Is cron service running on Debian or Ubuntu Linux?

Fig.01: Is cron service running on Debian or Ubuntu Linux?


You can check /var/log/syslog file to find out if cron service running or not using the grep command as follows:
$ sudo grep --color -i cron /var/log/syslog
Sample outputs:

Jan 17 17:43:21 planetvenus cron[229]: (CRON) INFO (pidfile fd = 3)
Jan 17 17:43:21 planetvenus cron[240]: (CRON) STARTUP (fork ok)
Jan 17 17:43:21 planetvenus cron[240]: (CRON) INFO (Running @reboot jobs)
Jan 17 18:01:01 planetvenus cron[240]: (*system*cache) NOT A REGULAR FILE (/etc/cron.d/cache)
Jan 17 18:01:01 planetvenus cron[240]: (*system*output) NOT A REGULAR FILE (/etc/cron.d/output)
Jan 17 18:11:45 planetvenus root: cronplanet
Jan 17 18:12:11 planetvenus root: cronplanet
Jan 17 18:17:01 planetvenus CRON[3911]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jan 17 18:23:31 planetvenus cron[3927]: (CRON) INFO (pidfile fd = 3)

Where are cron logs stored on Ubuntu Linux?

The logs are stored in /var/log/cron.log file. You need to configured it as follows. Edit /etc/rsyslog.d/50-default.conf file using a text editor such as vi or nano:
$ sudo vi /etc/rsyslog.d/50-default.conf
OR
$ sudo nano /etc/rsyslog.d/50-default.conf
Find the line:

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

Uncoment the line (i.e. remove #):

cron.*                          /var/log/cron.log

Restart the following two services:
$ sudo service rsyslog restart
$ sudo service cron restart

Sample outputs:

rsyslog stop/waiting
rsyslog start/running, process 4004
cron stop/waiting
cron start/running, process 4014

Now, where are cron errors logged in Ubuntu LTS server?

You need to view /var/log/cron.log file using the grep or tail command:
$ sudo grep something /var/log/cron.log
$ sudo more /var/log/cron.log
$ sudo tail -f /var/log/cron.log
$ sudo egrep -i 'error|log' /var/log/cron.log
$ sudo tail -F /var/log/cron.log

Sample outputs from my log file:

Jan 17 18:29:27 planetvenus cron[3988]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Jan 17 18:34:25 planetvenus cron[4013]: (CRON) INFO (pidfile fd = 3)
Jan 17 18:34:25 planetvenus cron[4014]: (CRON) STARTUP (fork ok)
Jan 17 18:34:25 planetvenus cron[4014]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Jan 17 18:45:01 planetvenus CRON[4039]: (root) CMD (/root/scripts/mk.rss.feed)
Jan 17 18:45:02 planetvenus CRON[4038]: (CRON) info (No MTA installed, discarding output)
Jan 17 18:50:01 planetvenus CRON[4051]: (root) CMD (/root/scripts/mk.rss.feed)
Jan 17 18:50:03 planetvenus CRON[4050]: (CRON) info (No MTA installed, discarding output)
Jan 17 18:55:01 planetvenus CRON[4060]: (root) CMD (/root/scripts/mk.rss.feed)
Jan 17 18:55:02 planetvenus CRON[4059]: (CRON) info (No MTA installed, discarding output)
Share this tutorial on:

{ 1 comment… add one }
  • dj February 6, 2016, 9:32 am

    As someone mentioned in a previous question, how’d you do this in a system.d environment? Can you tail a system.d binary log, not to mention grep?

Leave a Comment


   Tagged with: , , ,