Nginx记录post body中文内容

nginx 的变量$request_body 即为http请求的body数据

只有在 location中 有 proxy_pass,fastcgi_pass,scgi_pass命令存在时,$request_body变量才会有值。

nginx在记录http的body内容时,会将中文转义为16进制
在nginx 1.11.8 以上版本中log_format 增加了escape=json 参数,可以不转义变量内容:

log_format access escape=json '$request_time $remote_addr  "$request" "$request_body" $status "$http_referer" "$http_user_agent" '

参考:https://nginx.org/en/docs/http/ngx_http_log_module.html

posted @ 2019-12-20 19:11  wshenJin  阅读(2755)  评论(0编辑  收藏  举报