Ubuntu Create a cron.log File To Log crontab Logs [16.04/18.04/20.04]
To create a "cron.log" file to log crontab logs on Ubuntu 16.04, 18.04, and 20.04, you can use the following steps:
- Create the "cron.log" file:
# touch /var/log/cron.log- Change the ownership of the file to the syslog user:
# chown syslog:adm /var/log/cron.log- Edit the syslog configuration file:
# nano /etc/rsyslog.d/50-default.conf- Add the following line to the end of the file:
cron.* /var/log/cron.log- Restart the syslog service to apply the changes:
# service rsyslog restartThat's it! The "cron.log" file will now log all crontab logs. You can view the logs using the following command:
# tail -f /var/log/cron.logNote that these steps assume that you are using the default syslog implementation on Ubuntu. If you are using a different logging system, the steps to configure crontab logging may differ.
