一、syslog介绍
Syslog常被称为系统日志或系统记录,是一种用来在互联网协定(TCP/IP)的网络中传递记录当前信息的标准
二、syslog配置文件参数解释
一般配置文件位于/etc/syslog.conf
[root@svn ~]# cat /etc/syslog.conf # Log all kernel messages to the console. # Logging much else clutters up the screen. #kern.* /dev/console # Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;authpriv.none;cron.none /var/log/messages # The authpriv file has restricted access. authpriv.* /var/log/secure # Log all the mail messages in one place. mail.* -/var/log/maillog # Log cron stuff cron.* /var/log/cron # Everybody gets emergency messages *.emerg * # Save news errors of level crit and higher in a special file. uucp,news.crit /var/log/spooler # Save boot messages also to boot.log local7.* /var/log/boot.log
#kern.* /dev/console
#内核产生的所有日志 记录到终端设备文件中
*.info;mail.none;authpriv.none;cron.none /var/log/messages
#所有级别的info,但是不包括authpriv cron mail的日志信息,这里的none表示不包括的意思
# The authpriv file has restricted access. authpriv.* /var/log/secure
#安全信息相关日志,此日志的文件权限相当重要
# Log all the mail messages in one place. mail.* -/var/log/maillog
#mail相关日志记录,,为了保证日志信息的可用性,一般日志是同步写到磁盘当中去,横线为异步同步到硬盘,所以信息会先写到内存当中,再写到硬盘中
# Log cron stuff cron.* /var/log/cron
#计划任务信息所存放的日志路径
# Everybody gets emergency messages *.emerg *
#紧急情况日志,*代表所有用户
# Save news errors of level crit and higher in a special file. uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log local7.* /var/log/boot.log
#系统启动日志存放路径
三、举例
mail.info /var/log/mailog
mail.info :
#包括这个级别和这个级别高的所有级别产生的信息
mail.=!info :
#只记录info这个信息,其他不做记录
mail.!=info :
#除了info其他的级别,与mail.info /var/....相反
mail.*
#所有的信息
#如果将多个指定信息记录的日志输出到某日志当中,可以使用;号进行表示,如:
cron.info;mail.error /var/log/mes.log
#如果想记录mail所有级别信息,但除了info:
mail.*;mail.!=info /var/log/xxx.log