Skip to content


去除/var/log/messages中crond信息

messages含有过多的crond重复信息,影响阅读

tail /var/log/messages

Mar 4 14:18:01 localhost crond(pam_unix)[625]: session opened for user root by (uid=0)
Mar 4 14:18:01 localhost crond[626]: (root) CMD (/bin/sh /opt/shell/session_gc.sh > /dev/null 2>&1)
Mar 4 14:18:01 localhost crond(pam_unix)[625]: session closed for user root
Mar 4 14:19:01 localhost crond(pam_unix)[761]: session opened for user root by (uid=0)
Mar 4 14:19:01 localhost crond[762]: (root) CMD (/bin/sh /opt/shell/session_gc.sh > /dev/null 2>&1)
Mar 4 14:19:01 localhost crond(pam_unix)[761]: session closed for user root
Mar 4 14:20:01 localhost crond(pam_unix)[1172]: session opened for user root by (uid=0)
Mar 4 14:20:01 localhost crond[1174]: (root) CMD (if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi)
Mar 4 14:20:01 localhost crond(pam_unix)[1173]: session opened for user root by (uid=0)
Mar 4 14:20:01 localhost crond[1175]: (root) CMD (/bin/sh /opt/shell/session_gc.sh > /dev/null 2>&1)

修改syslog.conf,在messages的输出中增加cron.none;auth.none
cron和认证信息可以在/var/log/secure和/var/log/cron中查看
vi /etc/syslog.conf

*.info;mail.none;authpriv.none;cron.none;auth.none /var/log/messages

重启服务
/etc/init.d/crond restart

参考:
http://www.chinarhcx.com/node/7

Posted in linux 维护优化, 技术.

Tagged with , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.