openresty response响应resp_body为空,求各位大佬解答

需求,在nginx日志中打印出请求的response详细信息,

但是配置好了相关lua脚本之后resp_body为空;

 

nginx.conf 相关配置如下

 

由于有多个server,所以在很多server都加入了以下lua脚本

lua_need_request_body on;
        set $resp_body "";
        body_filter_by_lua '
        local resp_body = string.sub(ngx.arg[1], 1, 1000)
        ngx.ctx.buffered = (ngx.ctx.buffered or "") .. resp_body
        if ngx.arg[2] then
            ngx.var.resp_body = ngx.ctx.buffered
        end
        ';
 

 

求各位大佬解答啊

resp_body为空:

 

10.130.33.45 - - [11/Mar/2021:18:38:52 +0800] "POST /services/DealerToCustomerService/exclusive HTTP/1.1" 200 112 "-" "Java/1.8.0_144" "-" "/services/DealerToCustomerService/exclusive" resp_body:""