chr*_*ney 6 ubuntu logging syslog ubuntu-8.04
我一直在尝试通过 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
Run Code Online (Sandbox Code Playgroud)
我知道错误和访问日志被正确发送到 Syslog,因为它们显示在 中/var/log/syslog
,但是它们没有被写入我想要的文件。
目标文件的原始文件权限:
-rw-r----- 1 root adm 0 2010-06-20 23:01 access.log
Run Code Online (Sandbox Code Playgroud)
我一直在使用的目标文件的当前文件权限试图排除导致问题的此类事情:
-rw-rw-rw- 1 syslog adm 0 2010-06-20 23:01 access.log
Run Code Online (Sandbox Code Playgroud)
对我来说一切都很好,那么为什么 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
Run Code Online (Sandbox Code Playgroud)
小智 17
您是否重新启动了 syslogd?您还可以使用lsof -f -p <pid-of-syslogd>
查看它打开了哪些日志文件。syslog.conf 看起来不错,您可能想发布您的 apache 配置。
小智 5
对于那些在从 Ubuntu LTS 12.04 更新到 14.04.1 后在谷歌搜索中迷失了类似症状的人:syslog 被 rsyslog 取代,由于某种原因,它没有被发行版升级安装。
解决方法是 apt-get install rsyslog
归档时间: |
|
查看次数: |
26858 次 |
最近记录: |