comparison xml/en/docs/http/ngx_http_log_module.xml @ 2540:b686736680e3

Documented escaping rules in log_format.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 12 May 2020 22:06:12 +0100
parents 64004f50b9dd
children eeed494bba51
comparison
equal deleted inserted replaced
2539:5a5a791b3166 2540:b686736680e3
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="19"> 13 rev="20">
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
206 <para id="log_format_escape"> 206 <para id="log_format_escape">
207 The <literal>escape</literal> parameter (1.11.8) allows setting 207 The <literal>escape</literal> parameter (1.11.8) allows setting
208 <literal>json</literal> or <literal>default</literal> characters escaping 208 <literal>json</literal> or <literal>default</literal> characters escaping
209 in variables, by default, <literal>default</literal> escaping is used. 209 in variables, by default, <literal>default</literal> escaping is used.
210 The <literal>none</literal> value (1.13.10) disables escaping. 210 The <literal>none</literal> value (1.13.10) disables escaping.
211 </para>
212
213 <para id="log_format_escape_default">
214 For <literal>default</literal> escaping,
215 characters “<literal>"</literal>”, “<literal>\</literal>”,
216 and other characters with values less than 32 (0.7.0) or above 126 (1.1.6)
217 are escaped as “<literal>\xXX</literal>”.
218 If the variable value is not found,
219 a hyphen (“<literal>-</literal>”) will be logged.
220 </para>
221
222 <para id="log_format_escape_json">
223 For <literal>json</literal> escaping,
224 all characters not allowed
225 in JSON <link url="https://tools.ietf.org/html/rfc8259#section-7">strings</link>
226 will be escaped:
227 characters “<literal>"</literal>” and
228 “<literal>\</literal>” are escaped as
229 “<literal>\"</literal>” and “<literal>\\</literal>”,
230 characters with values less than 32 are escaped as
231 “<literal>\n</literal>”,
232 “<literal>\r</literal>”,
233 “<literal>\t</literal>”,
234 “<literal>\b</literal>”,
235 “<literal>\f</literal>”, or
236 “<literal>\u00XX</literal>”.
237
211 </para> 238 </para>
212 239
213 <para> 240 <para>
214 The log format can contain common variables, and variables that 241 The log format can contain common variables, and variables that
215 exist only at the time of a log write: 242 exist only at the time of a log write: