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

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

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

常见的nginx配置中access log一般都只有GET请求的参数,而POST请求的参数却不行。http://wiki.nginx.org/NginxHttpCoreModule#.24request_body
%n*G ^ W!xFM;L051Testing软件测试网Jr@a4L%[_0O/G
$request_body51Testing软件测试网,XG*P7ok%wdH

~:~l+g3W)e0This 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.
K7d9j&hN%Fj i4a0
!R!M~x|4n6f%W3uQ*v0正如上文件所示,只需要使用$request_body即可打出post的数据,在现存的server段加上下面的设置即可:
vZ&y`V&@ T.p0
-A/|o5j;g"Q0
:^\6e7^7]-d wpj4S0log_format access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" "$http_user_agent" $http_x_forwarded_for';
!v2]R@J$|r `nd0access_log logs/test.access.log access;
B&P)azlu|0

TAG: ACCESS Log nginx access log

 

评分:0

我来说两句

Open Toolbar