- Home
- Logging Guide
- Syslog analysis: Logging and analyzing cron job errors
Syslog analysis: Logging and analyzing cron job errors
In this page
- Introduction
- What are crob job errors?
- Analyzing cron job errors using EventLog Analyzer
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:
- Open etc/rsyslog.d/50-default.conf file.
- Uncomment the line #cron.*
- Then run, sudo service rsyslog restart command.
All your cron jobs will be logged to /var/log/cron.log file.
What are crob job errors?
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[15296]: (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.
Analyzing cron job errors using EventLog Analyzer
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.