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

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

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

日志文件还有许多的强大功能我给大家列举了一些:
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.
