ubuntu – 为什么Syslog没有将日志写入指定文件?

前端之家收集整理的这篇文章主要介绍了ubuntu – 为什么Syslog没有将日志写入指定文件?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我一直试图通过Syslog路由Apache的日志(由于某种原因,日志轮换已停止,使用Syslog和logrotate似乎是一个合理的解决方案).

我已将Apache的错误日志发送到local7,并通过记录程序将访问日志传送到local6.

我希望Syslog分别将错误和访问日志写入/var/log/apache2/error.log和/var/log/apache2/access.log.

为此,我在/etc/syslog.conf中添加了以下内容

# Logging for Apache using local7 facility for error messages
# and local6 for access log
# Added 20/06/2010 by Chris Bunney
local7.*                        /var/log/apache2/error.log
local6.*                        /var/log/apache2/access.log

我知道错误和访问日志正在正确地发送到Syslog,因为它们出现在/ var / log / syslog中,但它们没有写入我想要的文件.

目标文件的原始文件权限:

-rw-r----- 1 root adm       0 2010-06-20 23:01 access.log

我一直用来尝试排除导致问题的目标文件的当前文件权限:

-rw-rw-rw- 1 syslog adm       0 2010-06-20 23:01 access.log

一切看起来都不错,那么为什么Syslog收到的消息没有写入我想要的文件?我错过了一些简单的事吗?

cat /etc/syslog.conf的完整输出

#  /etc/syslog.conf     Configuration file for syslogd.
#
#                       For more information see syslog.conf(5)
#                       manpage.

#
# First some standard logfiles.  Log by facility.
#

auth,authpriv.*                 /var/log/auth.log
*.*;auth,authpriv.none          -/var/log/syslog
cron.*                          /var/log/cron.log
daemon.*                        -/var/log/daemon.log
kern.*                          -/var/log/kern.log
lpr.*                           -/var/log/lpr.log
mail.*                          -/var/log/mail.log
user.*                          -/var/log/user.log

#
# Logging for the mail system.  Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info                       -/var/log/mail.info
mail.warn                       -/var/log/mail.warn
mail.err                        /var/log/mail.err

# Logging for INN news system
#
news.crit                       /var/log/news/news.crit
news.err                        /var/log/news/news.err
news.notice                     -/var/log/news/news.notice

# Logging for Apache using local7 facility for error messages
# and local6 for access log
# Added 20/06/2010 by Chris Bunney
local7.*                        /var/log/apache2/error.log
local6.*                        /var/log/apache2/access.log

#
# Some `catch-all' logfiles.
#
*.=debug;\
        auth,authpriv.none;\
        news.none;mail.none     -/var/log/debug
*.=info;*.=notice;*.=warn;\
        auth,authpriv.none;\
        cron,daemon.none;\
        mail,news.none          -/var/log/messages

#
# Emergencies are sent to everybody logged in.
#
*.emerg                         *

#
# I like to have messages displayed on the console,but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
#       news.=crit;news.=err;news.=notice;\
#       *.=debug;*.=info;\
#       *.=notice;*.=warn       /dev/tty8

# The named pipe /dev/xconsole is for the `xconsole' utility.  To use it,# you must invoke `xconsole' with the `-file' option:
#
#    $xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below,or you'll go crazy if you have a reasonably
#      busy site..
#
daemon.*;mail.*;\
        news.err;\
        *.=debug;*.=info;\
        *.=notice;*.=warn       |/dev/xconsole
你重启了syslogd吗?您还可以使用lsof -f -p< pid-of-syslogd>查看它已打开的日志文件. syslog.conf看起来正确,您可能想要发布您的apache配置.

猜你在找的Ubuntu相关文章