Pipe cron output to syslog/journalctl

March 8, 2019 - Reading time: ~1 minute

Simple way to pipe cron script output to journalctl / syslog


MAILTO=""
* * * * * user (echo "testing") 2>&1 | logger -t tag-to-use

gives following in journalctl


$ journalctl SYSLOG_IDENTIFIER=tag-to-use
-- Logs begin at Tue 2019-02-26 16:48:53 UTC, end at Fri 2019-03-08 22:12:03 UTC. --
Mar 08 22:04:01 server tag-to-use[25769]: testing