我有一个反向代理,我想要logging请求正文当前看起来谎言
log_format my_tracking'“$ request”“$ http_soapaction”“$ http_content_type”“$ request_body”';
这是logging一切奇妙,现在我想logging这些请求的响应正文变得更加困难。 我一直在尝试使用Lua模块(我已经编译进Nginx 1.3.14),但是我找不到如何做到这一点的任何例子,我肯定会扩展我的技术能力,所以任何帮助都会被大大的接受。
谢谢,将编辑回复引用报告
事实上,在body_filter中设置variables,然后将其传递到日志文件不起作用。 我检查了这个configuration,它的工作,但不幸的是nginx日志数据到error.log:
error_log logs/error.log info; location / { set $myresponse; #we must declare it first, we cannot create vars in lua proxy_pass http://mybackendserver; body_filter_by_lua 'ngx.var.myresponse = ngx.arg[1] ngx.log(ngx.INFO,ngx.var.myresponse) '; } }
PS。 想知道如何login从lua模块访问日志。