Read cronjob logs guide to find errors in Linux OS

Category : Linux/ Unix

In our last blog post, we showed how we can list and edit the cronjobs in Linux. If you have not checked then head over to this link. In this guide, we will show how we can read cronjob logs in Linux. If you have not checked Cron logs will help in checking if a particular cron job ran at a particular time and performed specifically required functions.

Cronlogs are stored in /var/log directory and file name for logs is cron where you can find more cron logs with date appended in the file name like cron-20191124, cron-20191126, etc. These appended logs are past logs which are created and stored by logrotate Linux function. Most recent cron logs will always be available in cron file.
read cronjob logs

The cron log file will have logs stored in the following format.
Dec 21 08:26:01 server CROND[2047]: (root) CMD ( /opt/alt/python27/bin/python /usr/bin/

Dec 21 08:26:01 – Date and time when cron has run
server – the prefix of the hostname. Our server’s hostname is
CROND[2047] – The process ID of a particular cronjob that has run
(root) – The user under which particular cronjob has run. In our case its root user.
CMD  ( ) – Cronjob command that has run

With these, you can read cronjob logs and find if a particular job has run or not. For more loggings of a particular command, you can add >> cron.logat the end of the cronjob. Example below.
30 4 * * * /opt/alt/python27/bin/python /usr/bin/ >> /home/basezap/package_reinstaller.log

>> /home/basezap/package_reinstaller.log– it will write the output of cron command to package_reinstaller.log file in the home directory of basezap user.

Learn how to list and edit cronjobs in Linux.