1. 正在先生首页
  2. 技术开发

服务器日志中的另类 ::1 – – [20/Dec/2000:20:00:00 -0000] “OPTIONS * HTTP/1.0” 200 –

工作进行到要对服务器日志进行一遍梳理。过程中遇到很多问题,逐一记录下来。

首先遇到的是在 access_log 中存在的大量重复记录,大概每半分钟一次。

::1 - - [20/Dec/2000:20:00:00 -0000] "OPTIONS * HTTP/1.0" 200 -
::1 - - [20/Dec/2000:20:00:18 -0000] "OPTIONS * HTTP/1.0" 200 -
::1 - - [20/Dec/2000:20:00:23 -0000] "OPTIONS * HTTP/1.0" 200 -
::1 - - [20/Dec/2000:20:00:54 -0000] "OPTIONS * HTTP/1.0" 200 -
::1 - - [20/Dec/2000:20:01:24 -0000] "OPTIONS * HTTP/1.0" 200 -
::1 - - [20/Dec/2000:20:01:55 -0000] "OPTIONS * HTTP/1.0" 200 -
::1 - - [20/Dec/2000:20:02:28 -0000] "OPTIONS * HTTP/1.0" 200 -
::1 - - [20/Dec/2000:20:02:57 -0000] "OPTIONS * HTTP/1.0" 200 -
::1 - - [20/Dec/2000:20:03:28 -0000] "OPTIONS * HTTP/1.0" 200 -

从 ::1 不难看出来这是服务器内部的请求。 ::1 是 127.0.0.1 的 IPV6 格式。

这写来自服务器内部的日志记录官方解释如下

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.

These requests are perfectly normal and you do not, in general, need to worry about them. They can simply be ignored.

大意就是 Apache 自己不停的在保持自己处于清醒状态。可以在 Apache 的配置文件 httpd.conf 中增加

SetEnvIf Remote_Addr "::1" dontlog

然后重启服务器,世界一下子清净了。

参考:https://wiki.apache.org/httpd/InternalDummyConnection

原创文章,作者:Y.Y,如若转载,请注明出处:https://84361749.com/post/apache-log-access.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注