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

相关文章:

  • 2022-02-05
  • 2022-03-08
  • 2021-11-28
  • 2022-12-23
  • 2021-11-16
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2021-09-09
相关资源
相似解决方案