N00b - logging stream request / response
Joel Parker
joel.parker.gm at gmail.com
Tue Apr 25 18:32:26 UTC 2017
I am trying to log all request / response in a stream with a lua script I
found in git hub and am having issues figuring out where to put the
log_format directive. Here is what I currently have :
stream {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
local resp_body = ngx.arg[1]
ngx.ctx.buffered = (ngx.ctx.buffered or "") .. resp_body
if ngx.arg[2] then
ngx.var.resp_body = ngx.ctx.buffered
end
';
......
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170425/81e18f3e/attachment.html>
More information about the nginx
mailing list