Linux服务器日志管理详解(6)

其他设备也有自己的日志。UUCP和news设备能产生许多外部消息。它把这些消息存到自己的日志(/var/log/spooler)中并把级别限为"err"或更高。例如:

Save mail and news errors of level err and higher in aspecial file.

uucp,news.crit /var/log/spooler

当一个紧急消息到来时,可能想让所有的用户都得到。也可能想让自己的日志接收并保存。

#Everybody gets emergency messages, plus log them on anther machine
*.emerg *
*.emerg @linuxaid.com.cn

alert消息应该写到root和tiger的个人账号中:

#Root and Tiger get alert and higher messages
*.alert root,tiger

有时syslogd将产生大量的消息。例如内核("kern"设备)可能很冗长。用户可能想把内核消息纪录到/dev/console中。下面的例子表明内核日志纪录被注释掉了:

#Log all kernel messages to the console
#Logging much else clutters up the screen
#kern.* /dev/console

用户可以在一行中指明所有的设备。下面的例子把info或更高级别的消息送到/var/log/messages,除了mail以外。级别"none"禁止一个设备:

#Log anything(except mail)of level info or higher
#Don't log private authentication messages!
*.info:mail.none;autHPriv.none /var/log/messages

在有些情况下,可以把日志送到打印机,这样网络入侵者怎么修改日志都没有用了。通常要广泛纪录日志。Syslog设备是一个攻击者的显著目标。一个为其他主机维护日志的系统对于防范服务器攻击特别脆弱,因此要特别注意。

有个小命令logger为syslog(3)系统日志文件提供一个shell命令接口,使用户能创建日志文件中的条目。用法:logger 例如:logger This is a test!

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus