如何防止cron日志在syslog中注册?


9

/var/log/cron.log通过取消注释下面的行将我的crontab登录分开/etc/syslog.conf,但是它仍然写入/var/log/syslog

cron.*                                  /var/log/cron.log

我如何防止它写入/var/log/syslog

Answers:


10

您需要找到定义应发送到/ var / log / syslog的内容的行,并对其进行修改,以便不包含cron消息。例如,在Ubuntu系统上,我必须将/etc/rsyslog.d/50-default.conf文件输入syslog的以下条目:

*.*;auth,authpriv.none             -/var/log/syslog

更改为:

*.*;cron,auth,authpriv.none             -/var/log/syslog

做你想要的。请注意,上面利用了指定多个优先级与列表相同的功能的能力,如果您还没有.none优先级,则必须这样做,例如:

*.*;auth,authpriv.info;cron.none             -/var/log/syslog

谢谢。我可以请您详细描述答案的第二部分吗?
shgnInc

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.