kuda.ai

Thoughts on programming and music theory.

dark mode

How to log cron job outputs

Created on March 31, 2026

linux

This works on Ubuntu.

There are two layers to this problem:

  1. see meta logs of cron
  2. see the actual logs of the job

meta logs:

# 1: /var/log/syslog
sudo grep 'CRON' /var/log/syslog

# 2: journalctl
journalctl -u cron

This will tell you that the scheduled cron job ran, but show you the jobs output.

job logs:

You need to use redirection of STDOUT and STDERR. `>> ~/logs/job.log 2>&1

Example:

* * * * * cd /home/david/scripts/ && /home/linxbrew/.linuxbrew/bin/direnv exec . make -C retention retention >> cron.log 2>&1