更改 Apache 的 LogFormat

变更 LogFormat

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" common
(中略)
CustomLog "logs/access_log" combined

在被描述的部分中

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h\t%l\t%u\t%t\t\"%r\"\t%>s\t%b\t\"%{Referer}i\"\t\"%{User-Agent}i\"\t%D" combined_tsv
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" common
(中略)
CustomLog "logs/access_log" combined_tsv

将combined_tsv进行追加操作。通过这样做,原来的空格分隔符将变为制表符,从而使解析变得更加容易。

修改后的日志

127.0.0.1 -       -       [03/Aug/2012:13:01:15 +0900]    "POST /search/? HTTP/1.1"       200     172     "-"     "Python-urllib/2.6"     627276
127.0.0.1 -       -       [03/Aug/2012:13:01:14 +0900]    "POST /demo HTTP/1.1"   200     29802   "http://xxxx/demo"     "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.25 (KHTML, like Gecko) Version/6.0 Safari/536.25"     1570131

以某种形式输出。

CustomLog格式整理在http://httpd.apache.org/docs/2.2/ja/mod/mod_log_config.html#formats。

log 的发音

将生成的日志方便起见分割为九个部分。

    1. 127.0.0.1

 

    1. – –

 

    1. [03/Aug/2012:11:28:21 +0900]

 

    1. POST /搜索/? HTTP/1.1

 

    1. 200

 

    1. 47912

 

    1. “-“

 

    1. Python-urllib/2.6

 

    0

这9个输出部分表示着以下含义。

请把以下内容翻译成中文,只需提供一种选项:
“Can you please provide me with further details about the project?”

日志的内容 no naiyō)

1. IP地址或远程主机名 (IP address or remote hostname)

125.100.190.246 可以表达为 一百二十五.一百.一百九十.二百四十六。

2. 用户的远程登录名以及认证期间的用户名通过ident进行验证。

– Only need one option: 请用中文将以下内容进行释义。

3. 访问日期和时间

[2012年8月3日11时28分21秒,东九时区]

4. 请求头、文件名和协议版本。GET请求使用GET方式调用,POST请求使用POST方式调用。

发表对/search/的搜索请求,使用HTTP/1.1版本。

5. 状态码

二百

6. 传输的字节数。其中不包含标题行。

四万七千九百一十二

7. 来电号码的网址

“-”

“-”可以用汉语进行本地化。

8. 用户代理

Python-urllib/2.6的中文表述为:Python-urllib/2.6

处理请求所花费的时间(以微秒为单位)

把下列句子用中文本地化给出一个选项: