Apache other_vhosts_access.log 和 access.log 日志文件

Wiz*_*ard 5 linux debian logging apache-2.2

apache 访问日志有一个奇怪的问题。我收到了该网站的条目

/var/log/apache2/access.log
Run Code Online (Sandbox Code Playgroud)

/var/log/apache2/other_vhosts/access.log
Run Code Online (Sandbox Code Playgroud)

我正在使用 Debian 6,在 repo 中有最新的 Apache。当我查看文件时

/etc/apache2/conf.d/other-vhosts-access-log
Run Code Online (Sandbox Code Playgroud)

它说

# Define an access log for VirtualHosts that don't define their own logfile
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined
Run Code Online (Sandbox Code Playgroud)

但是当我查看该站点的 VirtualHost 声明时,它有

    CustomLog ${APACHE_LOG_DIR}/access.log vhost_combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

在文件底部。所以我已经声明了日志文件,那么为什么apache仍然向other_vhosts_access.log写入一个条目?

最后,我注释掉了 apache/conf.d 文件中的这一行,但我觉得这不是最好的方法。

我错过了什么?

use*_*517 2

如果没有看到完整的 apache 配置,这很难诊断,但需要注意一些事情

  • 检查您是否未在同一虚拟主机中包含或定义第二个日志文件 - 这将导致双重日志记录。
  • 检查日志文件是否彼此链接 -find /var/log/apache2 -samefile /var/log/apache2/access.log如果是这样,将列出它们。

考虑一下这是一个错误的可能性。