Linux Commands

How Do I Create a Dedicated Crontab History Log

Scripts and commands can run automatically at a set date and time by using cron jobs. Cron jobs are logged by default to a file called /var/log/Syslog. To view the most recent entries, we can use the systemctl command. So Crontab is a great command option, but many users do not know how to create or check the history. If you also don’t know how to do it, read this blog from start to end, as we will provide a brief on how to create a dedicated crontab history log.

What is Crontab in Linux?

Crontab is a set of commands which a user wants to run regularly. The word Crontab stands for the combination of cron and table as it uses the job scheduler cron for executing the tasks. Crontab is the name of the schedule, as well as the program used to edit it.

How Do I Create a Dedicated Crontab History Log?

It is very simple to find the crontab history logs on different operating systems. On Ubuntu, we can find the crontab history logs in the/var/syslog file. The Syslog directory contains the specific entries from the operating systems, and it is helpful for grep to isolate cron related messages. So run the following command in Ubuntu to access the crontab history log:

Sudo grep CRON /var/log/syslog

On CentOS,and Redhat, cron logs are stored into /var/log/cron. So execute the following command for it:

tail /var/log/cron

You can also display the crontab history log through the journalctl command if you have systemd installed in your system

Journalctl -u cron.service


So, this is how you can easily create a dedicated crontab history log and view it on Linux easily. If you found this article helpful, please visit our official website to learn more about Linux.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.