linux日志是我们发现故障,定位故障,排除故障的一种有效手段。熟练使用日志信息非常重要。下面是我对linux的日志的一些总结,主流的linux仍然使用syslogd做为守护进程,安装sysklog的日志服务器套件。
#rpm -aq|grep sysklog
#ps -ef|grep syslogd
#/etc/syslog.conf
#/var/log
#more /etc/syslog.conf
# 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
#把除邮件、新闻组、授权信息、计划任务等外的所有通知性消息都写入messages文件中
# The authpriv file has restricted access.
authpriv.* /var/log/secure
#把安全验证设备的信息写入secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
#把邮件信息写入maillog
# Log cron stuff
cron.* /var/log/cron
#把定时任务信息写入cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
#把uucp,news的crit级别信息写入spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
cat /var/log/messages
dmesg
who
lastlog
lastb
last
cat /var/log/boot.log
cat /var/log/cron
cat /var/log/acpid
cat /var/log/audit/audit.log
cat /var/log/spooler
cat /var/log/maillog
cat /var/log/rpmpkgs
cat /var/log/secure