Cron is a Linux service used to automatically execute scheduled commands. A cron job can also be a series of shell commands, scripts, or other programs that can perform a variety of functions including sending out an email to inform you of its execution completion.
The logs generated by each cron job will be different based on the type of job and how the output is generated. If there is a problem in the execution of the cron job, the logs provide clues about the cause of the problem.
You can also add additional logging information to the output if needed.
By default, your cron output will be logged to /var/log/syslog. You can change this to another location or a file from which you can perform the analysis.
If you want the cron output to be written on a file, then follow the below steps:
All your cron jobs will be logged to /var/log/cron.log file.
A cron error may appear in your log file if a process fails to run or complete.Here's an example of a cron job log.
May 14 22:20:01 ip-172-31-11-231 CRON: (ubuntu) CMD (echo 'Hello User!' 2>&1 | /usr/bin/logger -t helloCron)
May 14 22:20:01 ip-172-31-11-231 helloCron: Hello User!
Analyzing these cron job errors can help greatly in operational troubleshooting. You can do it either manually or using an automated log management solution.
EventLog Analyzer, a comprehensive log management solution, helps analyze syslogs and identify cron job events such as cron job started, cron job terminated, cron edits, and more. Learn more.
Zoho Corporation Pvt. Ltd. All rights reserved.