十五年测试老手,长期负责WEB\APP 项目测试,目前主要负责团队管理工作。

nginx的access log中记录post请求的参数

上一篇 / 下一篇  2011-05-15 19:15:35 / 个人分类:nginx

常见的nginx配置中access log一般都只有GET请求的参数,而POST请求的参数却不行。http://wiki.nginx.org/NginxHttpCoreModule#.24request_body51Testing软件测试网*KJXBX [hw

eP.P"l(JIcA]0$request_body
aT5n{y qTf051Testing软件测试网`K"\yTZ^|
This variable(0.7.58+) contains the body of the request. The significance of this variable appears in locations with directives proxy_pass or fastcgi_pass.
Z'[8Q$Vpk7k0
k E'F"QM}m0正如上文件所示,只需要使用$request_body即可打出post的数据,在现存的server段加上下面的设置即可:
+O,S"`9l6p3K6H&H$d051Testing软件测试网!yF*eB4{+H[fMG

5iw;k.l:U/cA]\0log_format access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" "$http_user_agent" $http_x_forwarded_for';51Testing软件测试网 }?E _ }4n{
access_log logs/test.access.log access;51Testing软件测试网%A[WK6x%xL1aD

TAG: ACCESS Log nginx access log

 

评分:0

我来说两句

Open Toolbar