View previous topic :: View next topic |
Author |
Message |
wallace1819 Apprentice
Joined: 17 Aug 2002 Posts: 195 Location: VT
|
Posted: Thu Apr 01, 2004 4:50 pm Post subject: cron logs |
|
|
Is there a way to supress the large number of ...
Code: | (test -x /usr/sbin/run-crons && /usr/sbin/run-crons ) |
messages that apear in /var/log/messages?
I'm using vixie-cron.
wally |
|
Back to top |
|
|
Robostyle n00b
Joined: 05 Jan 2004 Posts: 26 Location: The Netherlands
|
Posted: Thu Apr 01, 2004 6:15 pm Post subject: |
|
|
If you're using syslog-ng you could add a filter to /etc/syslog-ng/syslog-ng.conf to make the messages stop apearing:
add the lines:
Code: | filter f_cron { match("CRON"); };
filter f_cron_ignore { not filter(f_cron); }; |
modify the line:
Code: | log { source(src); destination(messages); }; |
to:
Code: | log { source(src); filter(f_cron_ignore); destination(messages); }; |
Don't forget to:
Code: | /etc/init.d/syslog-ng reload |
It's really a cool logger, you could also log the cron message to it's own log file just in case you still want to be able to see what it has been doing.
[edit] corrected a small error
Last edited by Robostyle on Thu Apr 01, 2004 7:36 pm; edited 1 time in total |
|
Back to top |
|
|
wallace1819 Apprentice
Joined: 17 Aug 2002 Posts: 195 Location: VT
|
Posted: Thu Apr 01, 2004 6:38 pm Post subject: |
|
|
thx! yea I'm using syslog-ng. I really need to find some time to learn the config file.
so this says....
Match anything containing "CRON["....
filter f_cron { match("CRON["); };
Do not log anythig that matches "f_cron"
filter f_cron_ignore { not filter(f_cron); };
log anything comming from "src" filter it through "f_cron_ignore" and write everthing else out to "messages"
log { source(src); filter(f_cron_ignore); destination(messages); };
so am i correct in assuming if i added after the above statement...
log { source(src); filter(f_cron); destination(cron.log); };
now all cron stuff will stay out of messages and in cron.log
???
thx for the help.
wally |
|
Back to top |
|
|
Robostyle n00b
Joined: 05 Jan 2004 Posts: 26 Location: The Netherlands
|
Posted: Thu Apr 01, 2004 7:36 pm Post subject: |
|
|
Yeah, but you have to set also a destination like:
Code: | destination cron.log { file("/var/log/cron.log"); }; |
And remove the [ after cron in the filter, because else it expects a regular expression. My mistake, i'll edit my post to reflect the changes. |
|
Back to top |
|
|
|