Redhat Linux 常见的日志文件和常用命令:成功地管理任何系统的关键之一,是要知道系统中正在发生什么事。Linux 中提供了异常日志,并且日志的细节是可配置的。Linux 日志都以明文形式存储,所以用户不需要特殊的工具就可以搜索和阅读它们。还可以编写脚本,来扫描这些日志,并基于它们的内容去自动执行某些功能。 Linux 日志存储在 /var/log 目录中。这里有几个由系统维护的日志文件,但其他服务和程序也可能会把它们的日志放在这里。大多数日志只有root账户才可以读,不过修改文件的访问权限 就可以让其他人可读。
成功地管理任何系统的关键之一,是要知道系统中正在 发生什么事。Linux 中提供了异常日志,并且日志的细节是可配置的。Linux 日志都以明文形式存储,所以用户不需要特殊的工具就可以搜索和阅读它们。还可以编写脚本,来扫描这些日志,并基于它们的内容去自动执行某些功能。 Linux 日志存储在 /var/log 目录中。这里有几个由系统维护的日志文件,但其他服务和程序也可能会把它们的日志放在这里。大多数日志只有root账户才可以读,不过修改文件的访问权限 就可以让其他人可读。
Sep 3 08:30:17 UNIX login[1275]: FAILED LOGIN 2 FROM (null) FOR suying, Authentication failure Sep 4 17:40:28 UNIX -- suying[2017]: LOGIN ON pts/1 BY suying FROM fcceec.www.ec8.pfcc.com.cn Sep 4 17:40:39 UNIX su(pam_unix)[2048]: session opened for user root by suying(uid=999)
crond F root ?? 0.00 secs Sun Aug 20 00:16 promisc_check.s S root ?? 0.04 secs Sun Aug 20 00:16 promisc_check root ?? 0.01 secs Sun Aug 20 00:16 grep root ?? 0.02 secs Sun Aug 20 00:16 tail root ?? 0.01 secs Sun Aug 20 00:16 sh root ?? 0.01 secs Sun Aug 20 00:15 ping S root ?? 0.01 secs Sun Aug 20 00:15 ping6.pl F root ?? 0.01 secs Sun Aug 20 00:15 sh root ?? 0.01 secs Sun Aug 20 00:15 ping S root ?? 0.02 secs Sun Aug 20 00:15 ping6.pl F root ?? 0.02 secs Sun Aug 20 00:15 sh root ?? 0.02 secs Sun Aug 20 00:15 ping S root ?? 0.00 secs Sun Aug 20 00:15 ping6.pl F root ?? 0.01 secs Sun Aug 20 00:15 sh root ?? 0.01 secs Sun Aug 20 00:15 ping S root ?? 0.01 secs Sun Aug 20 00:15 sh root ?? 0.02 secs Sun Aug 20 00:15 ping S root ?? 1.34 secs Sun Aug 20 00:15 locate root ttyp0 1.34 secs Sun Aug 20 00:15 accton S root ttyp0 0.00 secs Sun Aug 20 00:15
# Log all kernel messages to the kernlog. # Logging much else clutters up the screen. kern.* /var/log/kernlog
# Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;news.none;authpriv.none;cron.none /var/log/messages *.warning /var/log/syslog # 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, plus log them on another # machine. *.emerg # Save mail and news errors of level err and higher in a # special file. uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log local7.* /var/log/boot.log
# INN news.=crit /var/log/news/news.crit news.=err /var/log/news/news.err news.notice /var/log/news/news.notice
# see "man logrotate" for details # rotate log files weekly weekly #以7天为一个周期 # keep 4 weeks worth of backlogs rotate 4 #每隔4周备份日志文件 # send errors to root errors root #发生错误向root报告 # create new (empty) log files after rotating old ones create #转完旧的日志文件就创建新的日志文件 # uncomment this if you want your log files compressed #compress #指定是否压缩日志文件 # RPM packages drop log rotation information into this directory include /etc/logrotate.d
# no packages own lastlog or wtmp -- we'll rotate them here /var/log/wtmp { monthly create 0664 root utmp rotate 1 }
Redhat Linux 常见的日志文件和常用命令:成功地管理任何系统的关键之一,是要知道系统中正在发生什么事。Linux 中提供了异常日志,并且日志的细节是可配置的。Linux 日志都以明文形式存储,所以用户不需要特殊的工具就可以搜索和阅读它们。还可以编写脚本,来扫描这些日志,并基于它们的内容去自动执行某些功能。 Linux 日志存储在 /var/log 目录中。这里有几个由系统维护的日志文件,但其他服务和程序也可能会把它们的日志放在这里。大多数日志只有root账户才可以读,不过修改文件的访问权限 就可以让其他人可读。
成功地管理任何系统的关键之一,是要知道系统中正在 发生什么事。Linux 中提供了异常日志,并且日志的细节是可配置的。Linux 日志都以明文形式存储,所以用户不需要特殊的工具就可以搜索和阅读它们。还可以编写脚本,来扫描这些日志,并基于它们的内容去自动执行某些功能。 Linux 日志存储在 /var/log 目录中。这里有几个由系统维护的日志文件,但其他服务和程序也可能会把它们的日志放在这里。大多数日志只有root账户才可以读,不过修改文件的访问权限 就可以让其他人可读。
Sep 3 08:30:17 UNIX login[1275]: FAILED LOGIN 2 FROM (null) FOR suying, Authentication failure Sep 4 17:40:28 UNIX -- suying[2017]: LOGIN ON pts/1 BY suying FROM fcceec.www.ec8.pfcc.com.cn Sep 4 17:40:39 UNIX su(pam_unix)[2048]: session opened for user root by suying(uid=999)
crond F root ?? 0.00 secs Sun Aug 20 00:16 promisc_check.s S root ?? 0.04 secs Sun Aug 20 00:16 promisc_check root ?? 0.01 secs Sun Aug 20 00:16 grep root ?? 0.02 secs Sun Aug 20 00:16 tail root ?? 0.01 secs Sun Aug 20 00:16 sh root ?? 0.01 secs Sun Aug 20 00:15 ping S root ?? 0.01 secs Sun Aug 20 00:15 ping6.pl F root ?? 0.01 secs Sun Aug 20 00:15 sh root ?? 0.01 secs Sun Aug 20 00:15 ping S root ?? 0.02 secs Sun Aug 20 00:15 ping6.pl F root ?? 0.02 secs Sun Aug 20 00:15 sh root ?? 0.02 secs Sun Aug 20 00:15 ping S root ?? 0.00 secs Sun Aug 20 00:15 ping6.pl F root ?? 0.01 secs Sun Aug 20 00:15 sh root ?? 0.01 secs Sun Aug 20 00:15 ping S root ?? 0.01 secs Sun Aug 20 00:15 sh root ?? 0.02 secs Sun Aug 20 00:15 ping S root ?? 1.34 secs Sun Aug 20 00:15 locate root ttyp0 1.34 secs Sun Aug 20 00:15 accton S root ttyp0 0.00 secs Sun Aug 20 00:15
# Log all kernel messages to the kernlog. # Logging much else clutters up the screen. kern.* /var/log/kernlog
# Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;news.none;authpriv.none;cron.none /var/log/messages *.warning /var/log/syslog # 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, plus log them on another # machine. *.emerg # Save mail and news errors of level err and higher in a # special file. uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log local7.* /var/log/boot.log
# INN news.=crit /var/log/news/news.crit news.=err /var/log/news/news.err news.notice /var/log/news/news.notice
# see "man logrotate" for details # rotate log files weekly weekly #以7天为一个周期 # keep 4 weeks worth of backlogs rotate 4 #每隔4周备份日志文件 # send errors to root errors root #发生错误向root报告 # create new (empty) log files after rotating old ones create #转完旧的日志文件就创建新的日志文件 # uncomment this if you want your log files compressed #compress #指定是否压缩日志文件 # RPM packages drop log rotation information into this directory include /etc/logrotate.d
# no packages own lastlog or wtmp -- we'll rotate them here /var/log/wtmp { monthly create 0664 root utmp rotate 1 }