Linux 技术手札

Apache log 的 internal dummy connection

当开启 Apache 的 access_log 查看里面的内容,查询记录内简中会看到一堆 “internal dummy connection” 的记录:

::1 – – [26/Mar/2017:03:34:02 +0800] “OPTIONS * HTTP/1.0” 200 – “-” “Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.4.16 (internal dummy connection)”

根据 Apache 官方的说明, 这是 Apache HTTP Sever 管理它的子进程时,需要唤醒进程并建立的新连线,这个也是十分正常的 Log 记录:

When the Apache HTTP Server manages its child processes, it needs a way to wake up processes that are listening for new connections. To do this, it sends a simple HTTP request back to itself. This request will appear in the access_log file with the remote address set to the loop-back interface (typically 127.0.0.1 or ::1 if IPv6 is configured). If you log the User-Agent string (as in the combined log format), you will see the server signature followed by “(internal dummy connection)” on non-SSL servers. During certain periods you may see up to one such request for each httpd child process.

即然这个讯息没有问题,可能不用理会,或者直接设定将它略过,不会出现在 Access Log 里面,先开启 httpd.conf:

# vi /etc/httpd/conf/httpd.conf

找到 access_log 那一行, access_log 默认是这样:

在上面的上一行改成这样,以略过 “::1” 的记录:

最后重新启动 Apache, 便会略过 internal dummy connection 的纪录:

# systemctl restart httpd
Exit mobile version