diff 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
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_log_module.xml	Wed Apr 29 11:29:05 2020 +0300
+++ b/xml/en/docs/http/ngx_http_log_module.xml	Tue May 12 22:06:12 2020 +0100
@@ -10,7 +10,7 @@
 <module name="Module ngx_http_log_module"
         link="/en/docs/http/ngx_http_log_module.html"
         lang="en"
-        rev="19">
+        rev="20">
 
 <section id="summary">
 
@@ -210,6 +210,33 @@
 The <literal>none</literal> value (1.13.10) disables escaping.
 </para>
 
+<para id="log_format_escape_default">
+For <literal>default</literal> escaping,
+characters “<literal>"</literal>”, “<literal>\</literal>”,
+and other characters with values less than 32 (0.7.0) or above 126 (1.1.6)
+are escaped as “<literal>\xXX</literal>”.
+If the variable value is not found,
+a hyphen (“<literal>-</literal>”) will be logged.
+</para>
+
+<para id="log_format_escape_json">
+For <literal>json</literal> escaping,
+all characters not allowed
+in JSON <link url="https://tools.ietf.org/html/rfc8259#section-7">strings</link>
+will be escaped:
+characters “<literal>"</literal>” and
+“<literal>\</literal>” are escaped as
+“<literal>\"</literal>” and “<literal>\\</literal>”,
+characters with values less than 32 are escaped as
+“<literal>\n</literal>”,
+“<literal>\r</literal>”,
+“<literal>\t</literal>”,
+“<literal>\b</literal>”,
+“<literal>\f</literal>”, or
+“<literal>\u00XX</literal>”.
+
+</para>
+
 <para>
 The log format can contain common variables, and variables that
 exist only at the time of a log write: