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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM