Hello! On Thu, May 26, 2016 at 10:38:38AM +0200, Khramov Anton wrote:
> # HG changeset patch > # User Khramov Anton <[email protected]> > # Date 1464194463 -7200 > # Wed May 25 18:41:03 2016 +0200 > # Node ID 2e8a8398f0e2e928bdc4088e5999b1ebf481fd7c > # Parent bc6fd7afeed6f7433c60634d9b0867ea3241b217 > Log: Added "json" parameter which escapes backslashes in logs > > This patch makes JSON log format not being broken when nginx > escapes special characters, i.e. "/?var=\x22hello, world\x22" > log entry with json parameter will look like: > "/?var=\\x22hello, world\\x22", Such approach doesn't look correct for me. If you want to write valid JSON using the access log module, you may want to do exactly this: i.e., use proper JSON-style escaping (\uXXXX) and so on. On the other hand, I'm not sure it is at all possible, as JSON format assumes character encoding is known, and this is not the case with nginx as variables logged may contain arbitrary binary data. Alternatively, you may consider using appropriate module which is able to log JSON instead of constructing it using log_format. There is at least one 3rd party module available which implements logging into JSON. -- Maxim Dounin http://nginx.org/ _______________________________________________ nginx-devel mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-devel
