Escape characters in log files

David Phillips david at acz.org
Tue Jan 15 01:26:24 MSK 2008


nginx does not escape logged variables.  This makes it impossible to
reliably parse log entries.  This is what Apache does:

   For security reasons, starting with version 2.0.46, non-printable
   and other special characters in %r, %i and %o are escaped using
   \xhh sequences, where hh  stands for the hexadecimal representation
   of the raw byte. Exceptions from this rule are " and \, which are
   escaped by prepending a backslash, and all whitespace characters,
   which are written in their C-style notation (\n, \t, etc). In
   versions prior to 2.0.46, no escaping was performed on these strings
   so you had to be quite careful when dealing with raw log files.

   http://httpd.apache.org/docs/2.2/mod/mod_log_config.html

I would like to fix this in nginx.  What is the best way to handle this issue?





More information about the nginx mailing list