手机版
你好,游客 登录 注册
背景:
阅读新闻

Linux日志文件

[日期:2013-08-18] 来源:Linux社区  作者:wqianyniaionly [字体:大 中 小]

我给大家举个例子:我安装一个DHCP服务器

Linux日志文件

 

安装失败,在这个时候我们就可以通过查找日志文件来查看哪里安装错误

Linux日志文件

这个时候它提示我们,你这里多了一个“I:我们把这里删除

Linux日志文件

日志文件还有许多的强大功能我给大家列举了一些:

The facility is one of the followingkeywords: auth, authpriv, cron, daemon, kern, lpr, mail, mark, news, security

(same as auth), syslog, user, uucp and local0 through local7. The keyword security should not be usedanymore and mark

is only for internal use and therefore should not be used inapplications. Anyway, you may want tospecify and redi-

rect these messages here. The facility specifies the subsystem thatproduced the message, i.e. all mail programs log

with the mail facility (LOG_MAIL) if they log using syslog.

# Store critical stuff incritical

#

*.=crit;kern.none /var/adm/critical

所有的除了内核相关的crit这个级别的都会寄到/var/adm/critical

This will store all messages with the priority crit in the file/var/adm/critical, except for any kernel message.

# Kernel messages are first, storedin the kernel

# file, critical messages andhigher ones also go

# to another host and to theconsole

#

kern.* /var/adm/kernel

kern.crit @finlandia

kern.crit /dev/console

kern.info;kern.!err /var/adm/kernel-info

叹号是取反,也就是info到warning级别的会寄到

The first rule direct any message that has the kernel facility to thefile /var/adm/kernel.

The second statement directs all kernel messages of the priority critand higher to the remote host finlandia. This is

useful, because if the hostcrashes and the disks get irreparable errors you might not be able to read thestored mes-

sages. If they're on a remotehost, too, you still can try to find out the reason for the crash.

The third rule directs these messages to the actual console, so theperson who works on the machine will get them, too.

The fourth line tells the syslogdto save all kernel messages that come with priorities from info up to warningin the

file /var/adm/kernel-info. Everything from err and higher is excluded.

# The tcp wrapper loggs withmail.info, we display

# all the connections on tty12

#

mail.=info /dev/tty12

This directs all messages that uses mail.info (in source LOG_MAIL |LOG_INFO) to /dev/tty12, the 12th console. For

example the tcpwrapper tcpd(8) uses this as it's default.

# Store all mail concerning stuffin a file

#

mail.*;mail.!=info /var/adm/mail

This pattern matches all messages that come with the mail facility,except for the info priority. These willbe stored

in the file /var/adm/mail.

# Log all mail.info and news.infomessages to info

#

mail,news.=info /var/adm/info

This will extract all messages that come either with mail.info or with news.info and store them in the file

/var/adm/info.

linux
相关资讯       Linux日志  Linux日志文件 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款