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

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/word-image-436.png" data-lazy- height="183" src="data:image/svg xml,” width=”709″>

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

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

Journalctl -u cron.service

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/word-image-437.png" data-lazy- height="313" src="data:image/svg xml,” width=”716″>

Conclusion

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

<img alt="" data-lazy-src="https://secure.gravatar.com/avatar/a6dca3a5394c9d066a8078ddf9ede366?s=112&r=g" data-lazy- height="112" src="data:image/svg xml,” width=”112″>

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.