annotate xml/en/docs/http/ngx_http_log_module.xml @ 869:ade81792bdaa

Documented SPDY support. New SPDY module added and the "listen" directive description is updated.
author Homutov Vladimir <vl@nginx.com>
date Wed, 20 Mar 2013 15:00:06 +0400
parents 9dab69f2b71d
children 2a9e42106d6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1 <?xml version="1.0"?>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2
580
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 452
diff changeset
3 <!--
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 452
diff changeset
4 Copyright (C) Igor Sysoev
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 452
diff changeset
5 Copyright (C) Nginx, Inc.
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 452
diff changeset
6 -->
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 452
diff changeset
7
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
9
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
10 <module name="Module ngx_http_log_module"
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
11 link="/en/docs/http/ngx_http_log_module.html"
589
764fbac1b8b4 Added document revision.
Ruslan Ermilov <ru@nginx.com>
parents: 580
diff changeset
12 lang="en"
840
9dab69f2b71d Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 826
diff changeset
13 rev="9">
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
14
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
15 <section id="summary">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
16
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
17 <para>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
18 The <literal>ngx_http_log_module</literal> module writes request logs
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
19 in the specified format.
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
20 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
21
430
570b312367bd Documented the context of request logging.
Ruslan Ermilov <ru@nginx.com>
parents: 364
diff changeset
22 <para>
570b312367bd Documented the context of request logging.
Ruslan Ermilov <ru@nginx.com>
parents: 364
diff changeset
23 Requests are logged in a context of a location where processing ends.
570b312367bd Documented the context of request logging.
Ruslan Ermilov <ru@nginx.com>
parents: 364
diff changeset
24 This may be different from the original location, if an
570b312367bd Documented the context of request logging.
Ruslan Ermilov <ru@nginx.com>
parents: 364
diff changeset
25 <link doc="ngx_http_core_module.xml" id="internal">internal
570b312367bd Documented the context of request logging.
Ruslan Ermilov <ru@nginx.com>
parents: 364
diff changeset
26 redirect</link> happens during request processing.
570b312367bd Documented the context of request logging.
Ruslan Ermilov <ru@nginx.com>
parents: 364
diff changeset
27 </para>
570b312367bd Documented the context of request logging.
Ruslan Ermilov <ru@nginx.com>
parents: 364
diff changeset
28
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
29 </section>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
30
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
31
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
32 <section id="example" name="Example Configuration">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
33
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
34 <para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
35 <example>
795
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
36 log_format compression '$remote_addr - $remote_user [$time_local] '
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
37 '"$request" $status $bytes_sent '
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
38 '"$http_referer" "$http_user_agent" "$gzip_ratio"';
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
39
795
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
40 access_log /spool/logs/nginx-access.log compression buffer=32k;
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
41 </example>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
42 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
43
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
44 </section>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
45
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
46
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
47 <section id="directives" name="Directives">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
48
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
49 <directive name="access_log">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
50 <syntax>
364
bb51d3e17dd0 Style fixed.
Ruslan Ermilov <ru@nginx.com>
parents: 351
diff changeset
51 <value>path</value>
bb51d3e17dd0 Style fixed.
Ruslan Ermilov <ru@nginx.com>
parents: 351
diff changeset
52 [<value>format</value>
795
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
53 [<literal>buffer</literal>=<value>size</value>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
54 [<literal>flush</literal>=<value>time</value>]]]</syntax>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
55 <syntax>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
56 <value>path</value>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
57 <value>format</value>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
58 <literal>gzip[=<value>level</value>]</literal>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
59 [<literal>buffer</literal>=<value>size</value>]
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
60 [<literal>flush</literal>=<value>time</value>]</syntax>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
61 <syntax><literal>off</literal></syntax>
443
1b2264bdd433 Fixed default for the access_log directive.
Ruslan Ermilov <ru@nginx.com>
parents: 430
diff changeset
62 <default>logs/access.log combined</default>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
63 <context>http</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
64 <context>server</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
65 <context>location</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
66 <context>if in location</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
67 <context>limit_except</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
68
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
69 <para>
795
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
70 Sets the path, format, and configuration of the buffered log writes.
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
71 Several logs can be specified on the same level.
364
bb51d3e17dd0 Style fixed.
Ruslan Ermilov <ru@nginx.com>
parents: 351
diff changeset
72 The special value <literal>off</literal> cancels all
bb51d3e17dd0 Style fixed.
Ruslan Ermilov <ru@nginx.com>
parents: 351
diff changeset
73 <literal>access_log</literal> directives on the current level.
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
74 If format is not specified then the predefined format
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
75 “<literal>combined</literal>” is used.
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
76 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
77
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
78 <para>
840
9dab69f2b71d Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 826
diff changeset
79 If either the <literal>buffer</literal> or <literal>gzip</literal>
9dab69f2b71d Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 826
diff changeset
80 (1.3.10, 1.2.7)
795
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
81 parameter is used, writes to log will be buffered.
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
82 <note>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
83 The buffer size must not exceed the size of the atomic write to a disk file.
657
56fa3cab4ceb Completely dropped FreeBSD version information when talking about
Ruslan Ermilov <ru@nginx.com>
parents: 656
diff changeset
84 For FreeBSD this size is unlimited.
795
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
85 </note>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
86 </para>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
87
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
88 <para>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
89 When buffering is enabled, the data will be written to the file:
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
90 <list type="bullet">
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
91
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
92 <listitem>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
93 if the next log line does not fit into the buffer;
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
94 </listitem>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
95
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
96 <listitem>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
97 if the buffered data is older than specified by the <literal>flush</literal>
840
9dab69f2b71d Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 826
diff changeset
98 parameter (1.3.10, 1.2.7);
795
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
99 </listitem>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
100
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
101 <listitem>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
102 when a worker process is <link doc="../control.xml">re-opening</link> log
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
103 files or is shutting down.
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
104 </listitem>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
105
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
106 </list>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
107 </para>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
108
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
109 <para>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
110 If the <literal>gzip</literal> parameter is used, then the buffered data will
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
111 be compressed before writing to the file.
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
112 The compression level can be set between 1 (fastest, less compression)
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
113 and 9 (slowest, best compression).
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
114 By default the buffer size is equal to 64K bytes, and the compression level
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
115 is set to 1.
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
116 Since the data is compressed in atomic blocks, the log file can be decompressed
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
117 or read by “<literal>zcat</literal>” at any time.
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
118 </para>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
119
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
120 <para>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
121 Example:
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
122 <example>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
123 access_log /path/to/log.gz combined gzip flush=5m;
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
124 </example>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
125 </para>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
126
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
127 <para>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
128 <note>
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
129 For gzip compression to work, nginx must be built with the zlib library.
41363f013cc9 Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents: 779
diff changeset
130 </note>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
131 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
132
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
133 <para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
134 The file path can contain variables (0.7.6+),
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
135 but such logs have some constraints:
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
136 <list type="bullet">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
137
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
138 <listitem>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
139 the <link doc="../ngx_core_module.xml" id="user"/>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
140 whose credentials are used by worker processes should
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
141 have permissions to create files in a directory with
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
142 such logs;
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
143 </listitem>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
144
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
145 <listitem>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
146 buffered writes do not work;
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
147 </listitem>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
148
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
149 <listitem>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
150 a file is opened and closed for each log write.
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
151 However, since the descriptors of frequently used files can be stored
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
152 in a <link id="open_log_file_cache">cache</link>, writes during the
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
153 time specified by the <literal>valid</literal> parameter of the
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
154 <link id="open_log_file_cache"/> directive can continue to be made
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
155 to the old file.
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
156 </listitem>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
157
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
158 <listitem>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
159 during each log write the existence of the request’s
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
160 <link doc="ngx_http_core_module.xml" id="root">root directory</link>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
161 is checked, and if it does not exist the log is not
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
162 created.
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
163 It is thus a good idea to specify both
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
164 <link doc="ngx_http_core_module.xml" id="root"/>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
165 and <literal>access_log</literal> on the same level:
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
166 <example>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
167 server {
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
168 root /spool/vhost/data/$host;
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
169 access_log /spool/vhost/logs/$host;
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
170 ...
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
171 </example>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
172 </listitem>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
173
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
174 </list>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
175 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
176
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
177 </directive>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
178
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
179
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
180 <directive name="log_format">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
181 <syntax>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
182 <value>name</value>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
183 <value>string</value> ...</syntax>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
184 <default>combined "..."</default>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
185 <context>http</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
186
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
187 <para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
188 Specifies format of a log.
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
189 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
190
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
191 <para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
192 The log format can contain common variables, and variables that
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
193 exist only at the time of a log write:
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
194 <list type="tag">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
195
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
196 <tag-name><var>$bytes_sent</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
197 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
198 the number of bytes sent to a client
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
199 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
200
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
201 <tag-name><var>$connection</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
202 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
203 connection serial number
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
204 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
205
452
e9a2a856d76b Documented the $connection_requests variable.
Ruslan Ermilov <ru@nginx.com>
parents: 451
diff changeset
206 <tag-name><var>$connection_requests</var></tag-name>
e9a2a856d76b Documented the $connection_requests variable.
Ruslan Ermilov <ru@nginx.com>
parents: 451
diff changeset
207 <tag-desc>
769
d71e56d56ada Documented variables relocations between http log and core modules.
Vladimir Homutov <vl@nginx.com>
parents: 657
diff changeset
208 the current number of requests made through a connection (1.1.18)
452
e9a2a856d76b Documented the $connection_requests variable.
Ruslan Ermilov <ru@nginx.com>
parents: 451
diff changeset
209 </tag-desc>
e9a2a856d76b Documented the $connection_requests variable.
Ruslan Ermilov <ru@nginx.com>
parents: 451
diff changeset
210
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
211 <tag-name><var>$msec</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
212 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
213 time in seconds with a milliseconds resolution at the time of log write
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
214 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
215
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
216 <tag-name><var>$pipe</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
217 <tag-desc>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
218 “<literal>p</literal>” if request was pipelined, “<literal>.</literal>”
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
219 otherwise
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
220 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
221
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
222 <tag-name><var>$request_length</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
223 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
224 request length (including request line, header, and request body)
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
225 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
226
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
227 <tag-name><var>$request_time</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
228 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
229 request processing time in seconds with a milliseconds resolution;
451
6351ab788157 Documented $request_time more precisely.
Ruslan Ermilov <ru@nginx.com>
parents: 443
diff changeset
230 time elapsed between the first bytes were read from the client and
6351ab788157 Documented $request_time more precisely.
Ruslan Ermilov <ru@nginx.com>
parents: 443
diff changeset
231 the log write after the last bytes were sent to the client
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
232 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
233
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
234 <tag-name><var>$status</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
235 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
236 response status
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
237 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
238
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
239 <tag-name><var>$time_iso8601</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
240 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
241 local time in the ISO 8601 standard format
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
242 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
243
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
244 <tag-name><var>$time_local</var></tag-name>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
245 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
246 local time in the Common Log Format
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
247 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
248
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
249 </list>
826
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
250
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
251 <note>
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
252 In modern versions of nginx variables
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
253 <link doc="ngx_http_core_module.xml" id="var_status">$status</link>
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
254 (1.3.2, 1.2.2),
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
255 <link doc="ngx_http_core_module.xml" id="var_bytes_sent">$bytes_sent</link>
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
256 (1.3.8, 1.2.5),
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
257 <link doc="ngx_http_core_module.xml" id="var_connection">$connection</link>
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
258 (1.3.8, 1.2.5),
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
259 <link doc="ngx_http_core_module.xml" id="var_connection_requests">$connection_requests</link>
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
260 (1.3.8, 1.2.5),
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
261 <link doc="ngx_http_core_module.xml" id="var_msec">$msec</link>
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
262 (1.3.9, 1.2.6),
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
263 <link doc="ngx_http_core_module.xml" id="var_request_time">$request_time</link>
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
264 (1.3.9, 1.2.6),
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
265 <link doc="ngx_http_core_module.xml" id="var_pipe">$pipe</link>
840
9dab69f2b71d Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 826
diff changeset
266 (1.3.12, 1.2.7),
826
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
267 <link doc="ngx_http_core_module.xml" id="var_request_length">$request_length</link>
840
9dab69f2b71d Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 826
diff changeset
268 (1.3.12, 1.2.7),
826
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
269 <link doc="ngx_http_core_module.xml" id="var_time_iso8601">$time_iso8601</link>
840
9dab69f2b71d Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 826
diff changeset
270 (1.3.12, 1.2.7),
826
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
271 and
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
272 <link doc="ngx_http_core_module.xml" id="var_time_local">$time_local</link>
840
9dab69f2b71d Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents: 826
diff changeset
273 (1.3.12, 1.2.7)
826
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
274 are also available as common variables.
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
275 </note>
ddd22f571529 Variables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov <ru@nginx.com>
parents: 795
diff changeset
276
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
277 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
278
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
279 <para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
280 Header lines sent to a client have the prefix
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
281 “<literal>sent_http_</literal>”, for example,
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
282 <var>$sent_http_content_range</var>.
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
283 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
284
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
285 <para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
286 The configuration always includes the predefined format
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
287 “<literal>combined</literal>”:
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
288 <example>
351
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
289 log_format combined '$remote_addr - $remote_user [$time_local] '
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
290 '"$request" $status $body_bytes_sent '
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
291 '"$http_referer" "$http_user_agent"';
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
292 </example>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
293 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
294
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
295 </directive>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
296
364
bb51d3e17dd0 Style fixed.
Ruslan Ermilov <ru@nginx.com>
parents: 351
diff changeset
297
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
298 <directive name="open_log_file_cache">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
299
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
300 <syntax>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
301 <literal>max</literal>=<value>N</value>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
302 [<literal>inactive</literal>=<value>time</value>]
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
303 [<literal>min_uses</literal>=<value>N</value>]
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
304 [<literal>valid</literal>=<value>time</value>]</syntax>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
305 <syntax><literal>off</literal></syntax>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
306 <default>off</default>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
307 <context>http</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
308 <context>server</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
309 <context>location</context>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
310
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
311 <para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
312 Defines a cache that stores file descriptors of frequently used logs
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
313 whose names contain variables.
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
314 The directive has the following parameters:
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
315 <list type="tag">
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
316
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
317 <tag-name><literal>max</literal></tag-name>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
318 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
319 sets a maximum number of descriptors in a cache;
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
320 if cache becomes full the least recently used (LRU)
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
321 descriptors are closed
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
322 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
323
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
324 <tag-name><literal>inactive</literal></tag-name>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
325 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
326 sets a time after which the cached descriptor is closed
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
327 if there were no access during this time;
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
328 by default, 10 seconds
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
329 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
330
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
331 <tag-name><literal>min_uses</literal></tag-name>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
332 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
333 sets a minimum number of file uses during the time
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
334 defined by the <literal>inactive</literal> parameter
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
335 after which the descriptor will stay open in a cache;
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
336 by default, 1
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
337 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
338
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
339 <tag-name><literal>valid</literal></tag-name>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
340 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
341 sets a time after which it should be checked that the file
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
342 still exists with the same name; by default, 60 seconds
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
343 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
344
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
345 <tag-name><literal>off</literal></tag-name>
224
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
346 <tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
347 disables caching
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
348 </tag-desc>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
349
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
350 </list>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
351 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
352
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
353 <para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
354 Example usage:
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
355 <example>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
356 open_log_file_cache max=1000 inactive=20s valid=1m min_uses=2;
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
357 </example>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
358 </para>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
359
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
360 </directive>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
361
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
362 </section>
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
363
7f36795d99a2 Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
364 </module>