如何停止 Apache access.log 每隔几秒出现一次凹槽?

如何停止 Apache access.log 每隔几秒出现一次凹槽?

我从 安装了全新的 Ubuntu 12.04 Server + Zend Server CE (MySQL / PHPmyadmin) deb http://repos.zend.com/zend-server/5.6.0_ubuntu1204/deb server non-free Repository

我的 apache2/access.log 看起来像这样并且每隔几秒钟就会出现一次凹槽:

::1 - - [06/Aug/2012:13:27:59 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [06/Aug/2012:13:27:59 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [06/Aug/2012:13:27:59 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [06/Aug/2012:13:28:00 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [06/Aug/2012:13:28:00 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [06/Aug/2012:13:28:00 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [06/Aug/2012:13:28:00 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [06/Aug/2012:13:28:00 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
223.255.255.1 - - [06/Aug/2012:13:28:08 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:13 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:18 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:23 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:28 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:33 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:38 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:43 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:48 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:53 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"
223.255.255.1 - - [06/Aug/2012:13:28:58 +0200] "HEAD / HTTP/1.1" 200 276 "-" "-"

您知道为什么会发生这种情况以及如何预防吗?

答案1

您需要进行一些更改/etc/apache2/apache2.conf,具体来说:

  1. 使用 、 和 创建一些环境测试SetEnvIf

  2. 然后,使用它们就行了CustomLog。如下:

     SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
     SetEnvIf Remote_Addr "::1" dontlog
     SetEnvIf User-Agent ".*internal dummy connection.*" dontlog
    
     CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined env=!dontlog
    

    最后一行应该已经在文件中了,只是没有最后一位。

请注意,dontlog如果任何一个3 个SetEnvIf条件都成立。要避免这种情况,嗯,很复杂;但是这个博客似乎有一个解决办法。

答案2

答案3

请点击此处。 http://www.cathaycenturies.com/blog/?p=420

我认为你需要修改

/etc/apache2/站点可用/默认

以使其发挥作用。

答案4

这对我来说是工作

SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
CustomLog logs/access_log combined env=!loopback

我希望这对你也有用。

相关内容