Mercurial > hg > nginx-site
annotate xml/cn/docs/http/ngx_http_log_module.xml @ 2920:8033ffaedeb9
Documented automatic rotation of TLS ticket keys for stream/mail.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 22 Dec 2022 10:35:55 +0000 |
parents | ceb8a4e374b7 |
children |
rev | line source |
---|---|
792
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
3 <!-- |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Igor Sysoev |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
5 Copyright (C) Nginx, Inc. |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
6 --> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 <module name="ngx_http_log_module模块" |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 link="/cn/docs/http/ngx_http_log_module.html" |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
12 lang="cn" |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 translator="nigelzeng" |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 rev="3"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 <section id="summary"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 <literal>ngx_http_log_module</literal>模块按指定的格式写访问日志。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 请求在处理结束时,会按请求路径的配置上下文记访问日志。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 如果在请求处理期间产生了<link doc="ngx_http_core_module.xml" id="internal">内部跳转</link>, |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 请求结束时的路径可能不同于原始的请求路径。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 </section> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 <section id="example" name="配置实例"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 <example> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 log_format gzip '$remote_addr - $remote_user [$time_local] ' |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 '"$request" $status $bytes_sent ' |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 '"$http_referer" "$http_user_agent" "$gzip_ratio"'; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 access_log /spool/logs/nginx-access.log gzip buffer=32k; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 </example> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 </section> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 <section id="directives" name="指令"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 <directive name="access_log"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 <syntax> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
50 <value>path</value> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 [<value>format</value> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 [<literal>buffer</literal>=<value>size</value>]]</syntax> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 <syntax><literal>off</literal></syntax> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 <default>logs/access.log combined</default> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 <context>http</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 <context>server</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 <context>location</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
58 <context>if in location</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 <context>limit_except</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 为访问日志设置路径,格式和缓冲区大小(nginx访问日志支持缓存)。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
63 在同一个配置层级里可以指定多个日志。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
64 特定值<literal>off</literal>会取消当前配置层级里的所有<literal>access_log</literal>指令。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
65 如果没有指定日志格式则会使用预定义的“<literal>combined</literal>”格式。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
66 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
67 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
68 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 缓冲区的大小不能超过磁盘文件原子性写入的大小。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
70 对于FreeBSD来说缓冲区大小是无限制的。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
71 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 日志文件的路径可以包含变量(0.7.6+), |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 但此类日志存在一些限制: |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 <list type="bullet"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 <listitem> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 工作进程使用的<link doc="../ngx_core_module.xml" id="user"/> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
80 应拥有在目录里创建文件的权限; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
81 </listitem> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 <listitem> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 写缓冲无效; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
85 </listitem> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
87 <listitem> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
88 每条日志写入都会打开和关闭文件。然而,频繁使用的文件描述符可以存储在 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
89 <link id="open_log_file_cache">缓存</link>中, |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
90 在<link id="open_log_file_cache"/>指令的<literal>valid</literal>参数指定的时间里, |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
91 写操作能持续写到旧文件。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
92 </listitem> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
93 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
94 <listitem> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
95 每次日志写入的操作都会检查请求的 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
96 <link doc="ngx_http_core_module.xml" id="root">根目录</link>是否存在, |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
97 如果不存在则日志不会被创建。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
98 因此在一个层级里同时指定<link doc="ngx_http_core_module.xml" id="root"/> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
99 和<literal>access_log</literal>是一个不错的想法: |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
100 <example> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
101 server { |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
102 root /spool/vhost/data/$host; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
103 access_log /spool/vhost/logs/$host; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
104 ... |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
105 </example> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
106 </listitem> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
107 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
108 </list> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
109 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
110 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
111 </directive> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
112 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
113 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
114 <directive name="log_format"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
115 <syntax> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
116 <value>name</value> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
117 <value>string</value> ...</syntax> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
118 <default>combined "..."</default> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
119 <context>http</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
120 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
121 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
122 指定日志的格式。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
123 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
124 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
125 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
126 日志格式允许包含普通变量和只在日志写入时存在的变量: |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
127 <list type="tag"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
128 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
129 <tag-name><var>$body_bytes_sent</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
130 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
131 发送给客户端的字节数,不包括响应头的大小; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
132 该变量与Apache模块<literal>mod_log_config</literal>里的“<literal>%B</literal>”参数兼容。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
133 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
134 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
135 <tag-name><var>$bytes_sent</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
136 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
137 发送给客户端的总字节数。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
138 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
139 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
140 <tag-name><var>$connection</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
141 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
142 连接的序列号。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
143 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
144 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
145 <tag-name><var>$connection_requests</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
146 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
147 当前通过一个连接获得的请求数量。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
148 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
149 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
150 <tag-name><var>$msec</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
151 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
152 日志写入时间。单位为秒,精度是毫秒。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
153 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
154 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
155 <tag-name><var>$pipe</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
156 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
157 如果请求是通过HTTP流水线(pipelined)发送,pipe值为“<literal>p</literal>”,否则为“<literal>.</literal>”。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
158 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
159 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
160 <tag-name><var>$request_length</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
161 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
162 请求的长度(包括请求行,请求头和请求正文)。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
163 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
164 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
165 <tag-name><var>$request_time</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
166 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
167 请求处理时间,单位为秒,精度毫秒; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
168 从读入客户端的第一个字节开始,直到把最后一个字符发送给客户端后进行日志写入为止。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
169 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
170 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
171 <tag-name><var>$status</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
172 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
173 响应状态。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
174 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
175 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
176 <tag-name><var>$time_iso8601</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
177 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
178 ISO8601标准格式下的本地时间。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
179 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
180 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
181 <tag-name><var>$time_local</var></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
182 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
183 通用日志格式下的本地时间。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
184 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
185 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
186 </list> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
187 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
188 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
189 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
190 发送给客户端的响应头拥有“<literal>sent_http_</literal>”前缀。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
191 比如<var>$sent_http_content_range</var>。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
192 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
193 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
194 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
195 配置始终包含预先定义的“<literal>combined</literal>”日志格式: |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
196 <example> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
197 log_format combined '$remote_addr - $remote_user [$time_local] ' |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
198 '"$request" $status $body_bytes_sent ' |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
199 '"$http_referer" "$http_user_agent"'; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
200 </example> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
201 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
202 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
203 </directive> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
204 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
205 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
206 <directive name="open_log_file_cache"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
207 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
208 <syntax> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
209 <literal>max</literal>=<value>N</value> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
210 [<literal>inactive</literal>=<value>time</value>] |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
211 [<literal>min_uses</literal>=<value>N</value>] |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
212 [<literal>valid</literal>=<value>time</value>]</syntax> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
213 <syntax><literal>off</literal></syntax> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
214 <default>off</default> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
215 <context>http</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
216 <context>server</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
217 <context>location</context> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
218 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
219 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
220 定义一个缓存,用来存储频繁使用的文件名中包含变量的日志文件描述符。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
221 该指令包含以下参数: |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
222 <list type="tag"> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
223 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
224 <tag-name><literal>max</literal></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
225 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
226 设置缓存中描述符的最大数量;如果缓存被占满,最近最少使用(LRU)的描述符将被关闭。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
227 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
228 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
229 <tag-name><literal>inactive</literal></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
230 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
231 设置缓存文件描述符在多长时间内没有被访问就关闭; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
232 默认为10秒。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
233 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
234 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
235 <tag-name><literal>min_uses</literal></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
236 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
237 设置在<literal>inactive</literal>参数指定的时间里, |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
238 最少访问多少次才能使文件描述符保留在缓存中;默认为1。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
239 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
240 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
241 <tag-name><literal>valid</literal></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
242 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
243 设置一段用于检查超时后文件是否仍以同样名字存在的时间; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
244 默认为60秒。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
245 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
246 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
247 <tag-name><literal>off</literal></tag-name> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
248 <tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
249 禁用缓存。 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
250 </tag-desc> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
251 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
252 </list> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
253 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
254 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
255 <para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
256 使用实例: |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
257 <example> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
258 open_log_file_cache max=1000 inactive=20s valid=1m min_uses=2; |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
259 </example> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
260 </para> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
261 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
262 </directive> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
263 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
264 </section> |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
265 |
ceb8a4e374b7
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
266 </module> |