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

博主尝试通过Syslog将Apache的日志分别路由到错误和访问日志文件,但在配置完成后,日志仅出现在/var/log/syslog中,未按预期写入指定的error.log和access.log文件。已检查文件权限和syslog.conf配置,但问题仍未解决。文章展示了syslog.conf的内容以寻求帮助。
摘要由CSDN通过智能技术生成

我一直试图通过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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值