Linux如何把/var/log/messages 里面的部分日志重定向呢?请教!
目的就是想把下面的日志屏蔽掉;(或者把下面的日志重定向到其他文件夹也可以) Nov 27 16:21:41 localhost snmpd[3347]: Connection from UDP: [192.168.0.1]:34493 Nov 27 16:21:41 localhost snmpd[3347]: Received SNMP packet(s) from UDP: [192.168.0.1]:34493 Nov 27 16:21:41 localhost snmpd[3347]: Connection from UDP: [192.168.0.1]:55218 Nov 27 16:21:41 localhost snmpd[3347]: Received SNMP packet(s) from UDP: [192.168.0.1]:55218 Nov 27 16:21:41 localhost snmpd[3347]: Connection from UDP: [192.168.0.1]:55218 Nov 27 16:22:07 localhost snmpd[3347]: Connection from UDP: [192.168.0.1]:3696 Nov 27 16:22:07 localhost snmpd[3347]: Received SNMP packet(s) from UDP: [192.168.0.1]:3696 Nov 27 16:22:07 localhost snmpd[3347]: Connection from UDP: [192.168.0.1]:3696 Nov 27 16:22:07 localhost snmpd[3347]: Connection from UDP: [192.168.0.1]:3696 Nov 27 16:23:41 localhost snmpd[3347]: Connection from UDP: [192.168.0.1]:19691 网上有一种方法如下:vi /etc/init.d/snmpd 将这行改下就行。 #OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a" OPTIONS="-LS 0-4 d -Lf /dev/null -p /var/run/snmpd.pid -a" 保存重启 上面的日志没有啦,但是执行“service snmpd restart” 这个动作产生的信息没了,以后无论你怎么重启snmpd (在日志里面都没有如下两条的日志啦: Nov 27 16:36:57 localhost snmpd[3347]: Received TERM or STOP signal... shutting down... Nov 27 16:36:59 localhost snmpd[11401]: NET-SNMP version 5.3.2.2 ) 有什么办法能让重启的日志有,而Nov 27 16:23:41 localhost snmpd[3347]: Connection from UDP: [192.168.0.1]:19691 这些信息没有呢! 头疼啊!