Hi, I am running nginx version: nginx/1.24.0 as reverse proxy on CentOS Linux release 7.9.2009 (Core). I have the below config file /etc/nginx/conf.d/microservice.conf I want to capture full request/response body logging in nginx.
# cat /etc/nginx/conf.d/microservice.conf server { listen 80; server_name 192.168.0.129; location / { # Capture request headers and body log_by_lua_block { ngx.var.request_headers = ngx.req.raw_header() ngx.var.request_body = ngx.req.get_body_data() } # Your regular location configuration here # Capture response headers and body body_filter_by_lua_block { 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 } } #nginx -t *nginx: [emerg] unknown directive "log_by_lua_block" in* /etc/nginx/conf.d/microservice.conf:8 nginx: configuration file /etc/nginx/nginx.conf test failed Please guide me. Thanks in advance. Best Regards, Kaushal
_______________________________________________ nginx mailing list nginx@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx