Title: Better logging for cronjob output
- by Stefan Lasiewski
I am looking for a better way to log cronjobs. Most cronjobs tend to spam email or the console, get ignored, or create yet another logfile.
In this case, I have a Nagios NSCA script which sends data to a central Nagios sever. This send_nsca script also prints a single status line to STDOUT, indicating success or failure.
0 * * * * root /usr/local/nagios/sbin/nsca_check_disk
This emails the following message to root@localhost, which is then forwarded to my team of sysadmins. Spam.
forwarded nsca_check_disk: 1 data packet(s) sent to host successfully.
I'm looking for a log method which:
Doesn't spam the messages to email
or the console
Don't create yet another krufty logfile which requires cleanup
months or years later.
Capture the log information somewhere, so it can be viewed later
if desired.
Works on most unixes
Fits into an existing log infrastructure.
Uses common syslog conventions like 'facility'
Some of these are third party scripts, and don't always do logging
internally.