comparison xml/en/docs/http/ngx_http_log_module.xml @ 795:41363f013cc9

Documented the recently added "gzip" and "flush" parameters of the "access_log" directive.
author Valentin Bartenev <vbart@nginx.com>
date Tue, 25 Dec 2012 15:23:24 +0000
parents 32b8498cfb40
children ddd22f571529
comparison
equal deleted inserted replaced
794:e77512b1ce11 795:41363f013cc9
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> 8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
9 9
10 <module name="Module ngx_http_log_module" 10 <module name="Module ngx_http_log_module"
11 link="/en/docs/http/ngx_http_log_module.html" 11 link="/en/docs/http/ngx_http_log_module.html"
12 lang="en" 12 lang="en"
13 rev="6"> 13 rev="7">
14 14
15 <section id="summary"> 15 <section id="summary">
16 16
17 <para> 17 <para>
18 The <literal>ngx_http_log_module</literal> module writes request logs 18 The <literal>ngx_http_log_module</literal> module writes request logs
31 31
32 <section id="example" name="Example Configuration"> 32 <section id="example" name="Example Configuration">
33 33
34 <para> 34 <para>
35 <example> 35 <example>
36 log_format gzip '$remote_addr - $remote_user [$time_local] ' 36 log_format compression '$remote_addr - $remote_user [$time_local] '
37 '"$request" $status $bytes_sent ' 37 '"$request" $status $bytes_sent '
38 '"$http_referer" "$http_user_agent" "$gzip_ratio"'; 38 '"$http_referer" "$http_user_agent" "$gzip_ratio"';
39 39
40 access_log /spool/logs/nginx-access.log gzip buffer=32k; 40 access_log /spool/logs/nginx-access.log compression buffer=32k;
41 </example> 41 </example>
42 </para> 42 </para>
43 43
44 </section> 44 </section>
45 45
48 48
49 <directive name="access_log"> 49 <directive name="access_log">
50 <syntax> 50 <syntax>
51 <value>path</value> 51 <value>path</value>
52 [<value>format</value> 52 [<value>format</value>
53 [<literal>buffer</literal>=<value>size</value>]]</syntax> 53 [<literal>buffer</literal>=<value>size</value>
54 [<literal>flush</literal>=<value>time</value>]]]</syntax>
55 <syntax>
56 <value>path</value>
57 <value>format</value>
58 <literal>gzip[=<value>level</value>]</literal>
59 [<literal>buffer</literal>=<value>size</value>]
60 [<literal>flush</literal>=<value>time</value>]</syntax>
54 <syntax><literal>off</literal></syntax> 61 <syntax><literal>off</literal></syntax>
55 <default>logs/access.log combined</default> 62 <default>logs/access.log combined</default>
56 <context>http</context> 63 <context>http</context>
57 <context>server</context> 64 <context>server</context>
58 <context>location</context> 65 <context>location</context>
59 <context>if in location</context> 66 <context>if in location</context>
60 <context>limit_except</context> 67 <context>limit_except</context>
61 68
62 <para> 69 <para>
63 Sets the path, format, and buffer size for the buffered log writes. 70 Sets the path, format, and configuration of the buffered log writes.
64 Several logs can be specified on the same level. 71 Several logs can be specified on the same level.
65 The special value <literal>off</literal> cancels all 72 The special value <literal>off</literal> cancels all
66 <literal>access_log</literal> directives on the current level. 73 <literal>access_log</literal> directives on the current level.
67 If format is not specified then the predefined format 74 If format is not specified then the predefined format
68 “<literal>combined</literal>” is used. 75 “<literal>combined</literal>” is used.
69 </para> 76 </para>
70 77
71 <para> 78 <para>
79 If either the <literal>buffer</literal> or <literal>gzip</literal> (1.3.10)
80 parameter is used, writes to log will be buffered.
81 <note>
72 The buffer size must not exceed the size of the atomic write to a disk file. 82 The buffer size must not exceed the size of the atomic write to a disk file.
73 For FreeBSD this size is unlimited. 83 For FreeBSD this size is unlimited.
84 </note>
85 </para>
86
87 <para>
88 When buffering is enabled, the data will be written to the file:
89 <list type="bullet">
90
91 <listitem>
92 if the next log line does not fit into the buffer;
93 </listitem>
94
95 <listitem>
96 if the buffered data is older than specified by the <literal>flush</literal>
97 parameter (1.3.10);
98 </listitem>
99
100 <listitem>
101 when a worker process is <link doc="../control.xml">re-opening</link> log
102 files or is shutting down.
103 </listitem>
104
105 </list>
106 </para>
107
108 <para>
109 If the <literal>gzip</literal> parameter is used, then the buffered data will
110 be compressed before writing to the file.
111 The compression level can be set between 1 (fastest, less compression)
112 and 9 (slowest, best compression).
113 By default the buffer size is equal to 64K bytes, and the compression level
114 is set to 1.
115 Since the data is compressed in atomic blocks, the log file can be decompressed
116 or read by “<literal>zcat</literal>” at any time.
117 </para>
118
119 <para>
120 Example:
121 <example>
122 access_log /path/to/log.gz combined gzip flush=5m;
123 </example>
124 </para>
125
126 <para>
127 <note>
128 For gzip compression to work, nginx must be built with the zlib library.
129 </note>
74 </para> 130 </para>
75 131
76 <para> 132 <para>
77 The file path can contain variables (0.7.6+), 133 The file path can contain variables (0.7.6+),
78 but such logs have some constraints: 134 but such logs have some constraints: