|
|
|
[First name],
|
|
This week we have a simple question about cron logs, that kept getting more nuanced as we answered it.
|
Where can I find my cron job logs?
|
|
Cron logs are written to /var/log/syslog on Ubuntu and Debian, and /var/log/cron on RedHat and CentOS.
|
|
Show recent cron events in your syslog (Ubuntu and Debian):
|
|
grep CRON /var/log/syslog | tail -10
|
|
Show recent cron events in the cron log (RedHat and CentOS):
|
|
tail -10 /var/log/cron
|
|
You will likely require root/sudo privileges to access these logs.
|
What you'll find in the logs
|
|
Logs are written by the cron daemon when it starts-up, when it executes each job, and when it has an error reading a crontab file or running a requested command. Cron logs will not contain any of your cron job output or even their exit statuses.
|
|
If you are a CronitorCLI or Kubernetes user, complete job output and exit code is captured for every execution and is available on your dashboard in the "Latest Activity" section of each job.
|
How to read your cron logs
|
|
Cron logs store the hostname of the machine, the time the job was started, the user account, and the command run. In this example, a cron job ran on March 29th, on the data-processing host as the dataproc user. The command executed was /home/data-pipeline.py
|
|
Mar 29 16:15:01 data-processing CRON[12624]: (dataproc) CMD (/home/data-pipeline.py)
|
|
|
|
|
|
|
|
|
|
|