rsyslogd
daemon is responsible for collecting service messages coming from applications and the kernel, then dispatching them into log files (usually stored in the /var/log/
directory). It obeys the /etc/rsyslog.conf
configuration file.
auth
和 authpriv
:用于授权;
cron
:源于任务调度服务, cron
和 atd
;
daemon
:影响未分类的守护进程(DNS, NTP,等);
ftp
:涉及FTP 服务器;
kern
:源于内核的消息
lpr
:源于打印子系统;
mail
:源于电子邮件子系统;
news
:Usenet 子系统消息(主要源自NNTP -网络消息传输协议-管理新闻组的服务器);
syslog
:源于 syslogd
服务自身的消息;
user
:用户消息;
uucp
:源于UUCP(Unix to Unix Copy Program,一种老式的分发电子邮件消息的协议)服务的消息;
local0
到 local7
:保留本地使用。
emerg
: “Help!” There is an emergency, the system is probably unusable.
alert
赶快,任何推迟都是危险的,必须马上采取行动;
crit
:情况很严苛;
err
:错误;
warn
:警告(潜在的错误);
notice
:正常情况,但是该消息很重要;
info
:提供信息;
debug
:调试消息。
/etc/rsyslog.conf
文件的详细语法在 rsyslog.conf(5) 手册中,在 rsyslog-doc 软件包中也有一份 HTML 文档(/usr/share/doc/rsyslog-doc/html/index.html
)。总的原则是要写“选择器(selector)”和“行为(action)”配对。选择器定义所有相关消息,行为描述如何处理。
子系统清单。优先级
配对(例如: auth.notice;mail.info
)。星号代表所有的子系统和优先级(例如: *.alert
或者 mail.*
)。几个子系统可以通过逗号合并成组(例如: auth,mail.info
)。优先级指明相同或更高优先级的消息;因此 auth.alert
指具有 alert
和 emerg
优先级的auth
子系统消息。惊叹号(!)前缀表示求反,换句话说指低等级的优先级;因此 auth.!notice
指有 auth
产生的具有 info
或 debug
优先级的消息。等号(=)前缀表示精确指定某种优先级(auth.=notice
只关心具有 notice
优先级的 auth
消息)。优先级依次为:debug, info, notice, warning/warn, err/error , crit, alert, emerg/panic。
kern.info;kern.!err
表示源于内核优先级在 info
和 warn
之间的消息。 none
优先级指示空集(无优先级),可用于从集合中排除一个子系统消息。于是, *.crit;kern.none
指所有优先级等于或高于 crit
但不是来自内核的消息。