Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)
share|improve this question
    
What is it exactly that's being written to syslog? – Gene Aug 8 '15 at 4:00
    
Cron jobs running four times a minute? – womble Aug 8 '15 at 4:04
    
I've added the current output. – gijs007 Aug 8 '15 at 22:23
    
Indeed, you should not delete and repost; this can cause your account to be automatically rate limited or even banned by the system, and moderators cannot do anything about either. I've done what I can to salvage this. – Michael Hampton Aug 9 '15 at 1:05
    
so if you add >/dev/null 2>&1 after your command in crontab, does that help? – LHWizard Aug 9 '15 at 3:09

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.

share|improve this answer
    
Your answer got a "low quality" flag. It is because you only pasted a config line here, without a clear elaboration. I would suggest to complete your answer, fast. – peterh Aug 27 '15 at 14:16

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.

share|improve this answer
    
I just added the & stop part on a new line like you suggested. But the entry's are still logged. – gijs007 Aug 9 '15 at 2:12
    
@gijs007 Do you actually have a file /var/log/cron? Or doesn't even that work? – Shi Aug 9 '15 at 2:48
    
Yes that file exists and looks normal. Although it gets way to large. – gijs007 Aug 10 '15 at 2:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.