Mercurial > hg > nginx-site
annotate xml/en/docs/stream/ngx_stream_log_module.xml @ 2981:576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 01 Jun 2023 17:12:18 +0100 |
parents | 4add6ae1296f |
children |
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) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
452
diff
changeset
|
5 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
452
diff
changeset
|
6 |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 <!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
|
8 |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
9 <module name="Module ngx_stream_log_module" |
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
10 link="/en/docs/stream/ngx_stream_log_module.html" |
589 | 11 lang="en" |
2593
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2540
diff
changeset
|
12 rev="8"> |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 <section id="summary"> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 <para> |
1791
c36eb5d34651
Added appeared-in version for ngx_stream_log_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1777
diff
changeset
|
17 The <literal>ngx_stream_log_module</literal> module (1.11.4) writes session logs |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 in the specified format. |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 </para> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 </section> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 <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
|
25 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 <para> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 <example> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
28 log_format basic '$remote_addr [$time_local] ' |
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
29 '$protocol $status $bytes_sent $bytes_received ' |
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
30 '$session_time'; |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 |
1777
8b1ef02c8686
Corrected examples in ngx_stream_log_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1776
diff
changeset
|
32 access_log /spool/logs/nginx-access.log basic buffer=32k; |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 </example> |
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 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 </section> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 <section id="directives" name="Directives"> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 <directive name="access_log"> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 <syntax> |
364 | 43 <value>path</value> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
44 <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
|
45 [<literal>buffer</literal>=<value>size</value>] |
1694
080b36ad8d76
Reduced syntax clutter in the access_log directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1285
diff
changeset
|
46 [<literal>gzip[=<value>level</value>]</literal>] |
1168
384bb0349a8a
Documented the "if" parameter of the "access_log" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1155
diff
changeset
|
47 [<literal>flush</literal>=<value>time</value>] |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
48 [<literal>if</literal>=<value>condition</value>]</syntax> |
271 | 49 <syntax><literal>off</literal></syntax> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
50 <default>off</default> |
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
51 <context>stream</context> |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 <context>server</context> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 <para> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
55 Sets the path, <link id="log_format">format</link>, |
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
56 and configuration for a buffered log write. |
2593
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2540
diff
changeset
|
57 Several logs can be specified on the same configuration level. |
1285
4e89518a5999
Moved syslog configuration details into the separate documents.
Ruslan Ermilov <ru@nginx.com>
parents:
1205
diff
changeset
|
58 Logging to <link doc="../syslog.xml">syslog</link> |
4e89518a5999
Moved syslog configuration details into the separate documents.
Ruslan Ermilov <ru@nginx.com>
parents:
1205
diff
changeset
|
59 can be configured by specifying |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
939
diff
changeset
|
60 the “<literal>syslog:</literal>” prefix in the first parameter. |
364 | 61 The special value <literal>off</literal> cancels all |
62 <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
|
63 </para> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
64 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
65 <para> |
840
9dab69f2b71d
Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents:
826
diff
changeset
|
66 If either the <literal>buffer</literal> or <literal>gzip</literal> |
795
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
67 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
|
68 <note> |
966 | 69 The buffer size must not exceed the size of an 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
|
70 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
|
71 </note> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
72 </para> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
73 |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
74 <para> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
75 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
|
76 <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
|
77 |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
78 <listitem> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
79 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
|
80 </listitem> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
81 |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
82 <listitem> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
83 if the buffered data is older than specified by the <literal>flush</literal> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
84 parameter; |
795
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
85 </listitem> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
86 |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
87 <listitem> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
88 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
|
89 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
|
90 </listitem> |
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 </list> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
93 </para> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
94 |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
95 <para> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
96 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
|
97 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
|
98 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
|
99 and 9 (slowest, best compression). |
966 | 100 By default, the buffer size is equal to 64K bytes, and the compression level |
795
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
101 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
|
102 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
|
103 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
|
104 </para> |
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 <para> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
107 Example: |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
108 <example> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
109 access_log /path/to/log.gz basic gzip flush=5m; |
795
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
110 </example> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
111 </para> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
112 |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
113 <para> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
114 <note> |
41363f013cc9
Documented the recently added "gzip" and "flush" parameters of the "access_log"
Valentin Bartenev <vbart@nginx.com>
parents:
779
diff
changeset
|
115 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
|
116 </note> |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
117 </para> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
118 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
119 <para> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
120 The file path can contain variables, |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
121 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
|
122 <list type="bullet"> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
123 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
124 <listitem> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
125 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
|
126 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
|
127 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
|
128 such logs; |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
129 </listitem> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
130 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
131 <listitem> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
132 buffered writes do not work; |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
133 </listitem> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
134 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
135 <listitem> |
966 | 136 the file is opened and closed for each log write. |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
137 However, since the descriptors of frequently used files can be stored |
966 | 138 in a <link id="open_log_file_cache">cache</link>, writing to the old file |
139 can continue during the time specified by the <link id="open_log_file_cache"/> | |
140 directive’s <literal>valid</literal> parameter | |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
141 </listitem> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
142 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
143 </list> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
144 </para> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
145 |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
939
diff
changeset
|
146 <para> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
147 The <literal>if</literal> parameter enables conditional logging. |
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
148 A session will not be logged if the <value>condition</value> evaluates to “0” |
1168
384bb0349a8a
Documented the "if" parameter of the "access_log" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1155
diff
changeset
|
149 or an empty string. |
384bb0349a8a
Documented the "if" parameter of the "access_log" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1155
diff
changeset
|
150 </para> |
384bb0349a8a
Documented the "if" parameter of the "access_log" directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1155
diff
changeset
|
151 |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
152 </directive> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
153 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
154 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
155 <directive name="log_format"> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
156 <syntax> |
271 | 157 <value>name</value> |
2111
dab82d534f0f
Documented the "none" escape mode of the "log_format" directive.
Vladimir Homutov <vl@nginx.com>
parents:
1884
diff
changeset
|
158 [<literal>escape</literal>=<literal>default</literal>|<literal>json</literal>|<literal>none</literal>] |
271 | 159 <value>string</value> ...</syntax> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
160 <default></default> |
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
161 <context>stream</context> |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
162 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
163 <para> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
164 Specifies the log format, for example: |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
165 <example> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
166 log_format proxy '$remote_addr [$time_local] ' |
1777
8b1ef02c8686
Corrected examples in ngx_stream_log_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1776
diff
changeset
|
167 '$protocol $status $bytes_sent $bytes_received ' |
8b1ef02c8686
Corrected examples in ngx_stream_log_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1776
diff
changeset
|
168 '$session_time "$upstream_addr" ' |
1794
19eb203ffd41
Corrected variable name in the log module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1791
diff
changeset
|
169 '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
170 </example> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
171 </para> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
172 |
1874
33f742032155
Documented support for json escaping in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1794
diff
changeset
|
173 <para id="log_format_escape"> |
33f742032155
Documented support for json escaping in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1794
diff
changeset
|
174 The <literal>escape</literal> parameter (1.11.8) allows setting |
1884
0b339643b08f
Changed <value> to <literal> in log_fomrat.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1874
diff
changeset
|
175 <literal>json</literal> or <literal>default</literal> characters escaping |
0b339643b08f
Changed <value> to <literal> in log_fomrat.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1874
diff
changeset
|
176 in variables, by default, <literal>default</literal> escaping is used. |
2111
dab82d534f0f
Documented the "none" escape mode of the "log_format" directive.
Vladimir Homutov <vl@nginx.com>
parents:
1884
diff
changeset
|
177 The <literal>none</literal> parameter (1.13.10) disables escaping. |
1874
33f742032155
Documented support for json escaping in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1794
diff
changeset
|
178 </para> |
33f742032155
Documented support for json escaping in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1794
diff
changeset
|
179 |
2540
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
180 <para id="log_format_escape_default"> |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
181 For <literal>default</literal> escaping, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
182 characters “<literal>"</literal>”, “<literal>\</literal>”, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
183 and other characters with values less than 32 or above 126 |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
184 are escaped as “<literal>\xXX</literal>”. |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
185 If the variable value is not found, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
186 a hyphen (“<literal>-</literal>”) will be logged. |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
187 </para> |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
188 |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
189 <para id="log_format_escape_json"> |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
190 For <literal>json</literal> escaping, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
191 all characters not allowed |
2831
4add6ae1296f
Updated links to datatracker.ietf.org.
Sergey Kandaurov <pluknet@nginx.com>
parents:
2593
diff
changeset
|
192 in JSON <link url="https://datatracker.ietf.org/doc/html/rfc8259#section-7">strings</link> |
2540
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
193 will be escaped: |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
194 characters “<literal>"</literal>” and |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
195 “<literal>\</literal>” are escaped as |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
196 “<literal>\"</literal>” and “<literal>\\</literal>”, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
197 characters with values less than 32 are escaped as |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
198 “<literal>\n</literal>”, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
199 “<literal>\r</literal>”, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
200 “<literal>\t</literal>”, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
201 “<literal>\b</literal>”, |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
202 “<literal>\f</literal>”, or |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
203 “<literal>\u00XX</literal>”. |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
204 </para> |
b686736680e3
Documented escaping rules in log_format.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2111
diff
changeset
|
205 |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
206 </directive> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
207 |
364 | 208 |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
209 <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
|
210 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
211 <syntax> |
271 | 212 <literal>max</literal>=<value>N</value> |
213 [<literal>inactive</literal>=<value>time</value>] | |
214 [<literal>min_uses</literal>=<value>N</value>] | |
215 [<literal>valid</literal>=<value>time</value>]</syntax> | |
216 <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
|
217 <default>off</default> |
1776
8d0372178e00
Documented the ngx_stream_log_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1694
diff
changeset
|
218 <context>stream</context> |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
219 <context>server</context> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
220 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
221 <para> |
966 | 222 Defines a cache that stores the file descriptors of frequently used logs |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
223 whose names contain variables. |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
224 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
|
225 <list type="tag"> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
226 |
271 | 227 <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
|
228 <tag-desc> |
966 | 229 sets the maximum number of descriptors in a cache; |
230 if the cache becomes full the least recently used (LRU) | |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
231 descriptors are closed |
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 |
271 | 234 <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
|
235 <tag-desc> |
966 | 236 sets the time after which the cached descriptor is closed |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
237 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
|
238 by default, 10 seconds |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
239 </tag-desc> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
240 |
271 | 241 <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
|
242 <tag-desc> |
966 | 243 sets the minimum number of file uses during the time |
271 | 244 defined by the <literal>inactive</literal> parameter |
966 | 245 to let the descriptor stay open in a cache; |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
246 by default, 1 |
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 |
271 | 249 <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
|
250 <tag-desc> |
966 | 251 sets the time after which it should be checked that the file |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
252 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
|
253 </tag-desc> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
254 |
271 | 255 <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
|
256 <tag-desc> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
257 disables caching |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
258 </tag-desc> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
259 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
260 </list> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
261 </para> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
262 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
263 <para> |
966 | 264 Usage example: |
224
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
265 <example> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
266 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
|
267 </example> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
268 </para> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
269 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
270 </directive> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
271 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
272 </section> |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
273 |
7f36795d99a2
Updated ngx_http_log_module documentation including translation into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
274 </module> |