![如何停止 Apache access.log 每隔几秒出现一次凹槽?](https://linux22.com/image/1111155/%E5%A6%82%E4%BD%95%E5%81%9C%E6%AD%A2%20Apache%20access.log%20%E6%AF%8F%E9%9A%94%E5%87%A0%E7%A7%92%E5%87%BA%E7%8E%B0%E4%B8%80%E6%AC%A1%E5%87%B9%E6%A7%BD%EF%BC%9F.png)
我从 安装了全新的 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
,具体来说:
使用 、 和 创建一些环境测试
SetEnvIf
;然后,使用它们就行了
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
答案4
这对我来说是工作
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
CustomLog logs/access_log combined env=!loopback
我希望这对你也有用。