-
I try to use $resp_body in config.yml but failed. nginx_config: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
There is no built-in variable support to get the response body, if your response body size is unpredictable, I suggest you don't log it, it will make your log size very large.
2、set log format:
3、Customize a plugin to assign a value to $resp_bdoy: function _M.body_filter(conf, ctx)
local body = core.response.hold_body_chunk(ctx)
ctx.var.resp_body = body
.............
end |
Beta Was this translation helpful? Give feedback.
-
request feature: can you add this as an plugin like proxy-mirror ???,some time my develop team need response from upstream via apisix before apisix send backto client. |
Beta Was this translation helpful? Give feedback.
There is no built-in variable support to get the response body, if your response body size is unpredictable, I suggest you don't log it, it will make your log size very large.
But, If you insist on doing this, you can use the following way:
1、Set a var like:
2、set log format:
3、Customize a plugin to assign a value to $resp_bdoy: