本文介绍了了解Apache的访问日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的访问日志中这一行中的每一项是什么意思?

What do each of the things in this line from my access log mean?

127.0.0.1 - - [05/Feb/2012:17:11:55 +0000] "GET/HTTP/1.1" 200 140 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML,如 Gecko) Chrome/18.0.1025.5 Safari/535.19"

推荐答案

您似乎正在使用 组合日志格式.

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" 组合

  • %h 是远程主机(即客户端 IP)
  • %l 是 identd 确定的用户身份(不常用,因为不可靠)
  • %u 是 HTTP 认证确定的用户名
  • %t 是收到请求的时间.
  • %r 是来自客户端的请求行.("GET/HTTP/1.0")
  • %>s 是从服务器发送到客户端的状态码(200、404 等)
  • %b 是对客户端的响应大小(以字节为单位)
  • Referer 是 HTTP 的 Referer 标头请求(包含发起此请求的页面的 URL)(如果存在),否则为 "-".
  • User-agent 是浏览器标识字符串.
    • %h is the remote host (ie the client IP)
    • %l is the identity of the user determined by identd (not usually used since not reliable)
    • %u is the user name determined by HTTP authentication
    • %t is the time the request was received.
    • %r is the request line from the client. ("GET / HTTP/1.0")
    • %>s is the status code sent from the server to the client (200, 404 etc.)
    • %b is the size of the response to the client (in bytes)
    • Referer is the Referer header of the HTTP request (containing the URL of the page from which this request was initiated) if any is present, and "-" otherwise.
    • User-agent is the browser identification string.
    • 可以在此处找到完整的 (?) 格式化程序列表.文档的同一部分还列出了其他常见的日志格式;那些日志看起来不太像这个的读者可能会发现他们的 Apache 配置使用的模式在那里列出.

      The complete(?) list of formatters can be found here. The same section of the documentation also lists other common log formats; readers whose logs don't look quite like this one may find the pattern their Apache configuration is using listed there.

      这篇关于了解Apache的访问日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 08:14