Stop crontab from filling syslog Ubuntu 15.04
How can I prevent (certain cronjobs) from filling my syslog in Ubuntu 15.04? I have some jobs that run 4 times a minute and quickly fill up my syslog files.
I've tried adding:
cron.* /var/log/cron
to /etc/rsyslog.conf, but this didn't resolve anything.
The current output is:
Aug 8 06:58:01 elitegameservers CRON[25706]: (gijs) CMD ( sleep 15; unison -batch /var/www ssh://server1//var/www)
Aug 8 06:58:01 elitegameservers CRON[25703]: (gijs) CMD ( sleep 30; unison -batch /var/www ssh://server2//var/www)
Aug 8 06:58:01 elitegameservers CRON[25708]: (gijs) CMD (unison -batch /var/www ssh://server2//var/www)
Aug 8 06:58:01 elitegameservers CRON[25713]: (gijs) CMD ( sleep 30; unison -batch /var/www ssh://server1//var/www)
Aug 8 06:58:01 elitegameservers CRON[25714]: (gijs) CMD ( sleep 45; unison -batch /var/www ssh://server1//var/www)
Aug 8 06:58:01 elitegameservers CRON[25717]: (gijs) CMD ( unison -batch /var/www ssh:// server3//var/www)
Aug 8 06:58:01 elitegameservers CRON[25719]: (gijs) CMD ( sleep 15; unison -batch /var/www ssh:// server3//var/www)
Aug 8 06:58:01 elitegameservers CRON[25690]: (CRON) info (No MTA installed, discarding output)
Aug 8 06:58:01 elitegameservers CRON[25694]: (CRON) info (No MTA installed, discarding output)
Aug 8 06:58:08 elitegameservers CRON[25588]: (CRON) info (No MTA installed, discarding output)
Solution 1:
Try adding cron.none to the line that logs to syslog
*.*;auth,authpriv.none,cron.none -/var/log/syslog
EDIT: more detail: From the ubuntu manpage for syslog http://manpages.ubuntu.com/manpages/hardy/man5/syslog.conf.5.html
The special level ‘‘none’’ disables a particular facility.
The *.*
at the beginning says send everything to the designated file. You can then qualify this after the ;
to stop specific messages being sent there. Here,we're saying that we don't want auth messages to be seen and now we don't want cron messages either.There's nothing to stop you putting cron messages somewhere else and the default file has several lines commented out to split up the logs in this way. All you have to do is un-comment them.
You can also limit the messages you get for a particular facility, by changing the level for example from cron.* which would log all messages, to cron.warn which would just log warning messages.
Thanks for the heads-up @peterh I'm new at this Linux community stuff.
Solution 2:
I guess you restarted rsyslog
. As a result, you should then see your messages twice - once in /var/log/syslog
and once in /var/log/cron
.
So what you are missing is that after logging to /var/log/cron
, processing should stop.
cron.* /var/log/cron
& stop
You can also configure filters to only log some messages somewhere else, or not at all - have a look at the rsyslog filters manual for that.