我在 Solaris 10 上使用 syslog 时遇到了一些问题。看来配置不正确,日志消息只是堆积起来,而从未写入 /var/adm/messages。
/var/adm/messages 中的内容如下:
Sep 10 03:10:17 air syslogd: Could not completely output pending messages while preparing re-configuration
Sep 10 03:10:17 air syslogd: discarded 1082 messages and restart configuration.
Sep 12 03:10:17 air syslogd: Could not completely output pending messages while preparing re-configuration
Sep 12 03:10:17 air syslogd: discarded 436 messages and restart configuration.
我发出了这个命令:
$ logger -p daemon.notice "TESTING LOGGING"
并在 /var/adm/messages 中获得输出:
Sep 14 11:52:43 air gkwrcc: [ID 702911 daemon.notice] TESTING LOGGING
但似乎没有其他消息。
这是我的 /etc/syslog.conf:
#ident "@(#)syslog.conf 1.5 98/12/14 SMI" /* SunOS 5.0 */
#
# Copyright (c) 1991-1998 by Sun Microsystems, Inc.
# All rights reserved.
#
# syslog configuration file.
#
# This file is processed by m4 so be careful to quote (`') names
# that match m4 reserved words. Also, within ifdef's, arguments
# containing commas must be quoted.
#
*.err;kern.notice;auth.notice /dev/sysmsg
*.err;kern.debug;daemon.notice;mail.crit /var/adm/messages
auth.info /var/adm/auth.log
*.alert;kern.err;daemon.err operator
*.alert root
*.emerg *
# if a non-loghost machine chooses to have authentication messages
# sent to the loghost machine, un-comment out the following line:
#auth.notice ifdef(`LOGHOST', /var/log/authlog, @loghost)
mail.debug ifdef(`LOGHOST', /var/log/syslog, @loghost)
#
# non-loghost machines will use the following lines to cause "user"
# log messages to be logged locally.
#
ifdef(`LOGHOST', ,
user.err /dev/sysmsg
user.err /var/adm/messages
user.alert `root, operator'
user.emerg *
)
答案1
您似乎在几个地方使用了反引号,而这些地方可能应该是单引号。