apisix icon indicating copy to clipboard operation
apisix copied to clipboard

request help: logger plugins supports limit size of request/response body

Open tzssangglass opened this issue 4 years ago • 7 comments

Discussed in https://github.com/apache/apisix/discussions/5892

Originally posted by lrfdehao December 23, 2021 Suppose I have two fields, include_resp_body as the switch, resp_limit_size as the limit size. After configuring these two parameters, if resp_body exceeds the size of resp_limit_size, resp_body will not be recorded in the log. The same is true for req_body

tzssangglass avatar Dec 24 '21 05:12 tzssangglass

we can truncate oversized request and response bodies based on limit size

tzssangglass avatar Dec 24 '21 05:12 tzssangglass

LGTM

jagerzhang avatar Dec 24 '21 07:12 jagerzhang

LGTM

juzhiyuan avatar Dec 29 '21 02:12 juzhiyuan

Hi @juzhiyuan The pr is not merged. do we have any plan to support this feature? This is a good idea in production environment to do api statistics. And for now (apisix version 3.1.0), do we have any workaround for this? I don't think all http response has a content-length header.

gaoxingliang avatar Jan 31 '23 01:01 gaoxingliang

cc @leslie-tsang

juzhiyuan avatar Feb 01 '23 00:02 juzhiyuan

@pixeldin How about this PR to support truncat the body if it's too large in loggers?

gaoxingliang avatar Feb 07 '23 08:02 gaoxingliang

@Baoyuantop i think this issue has been resolved recently, look #13034 #11133

janiussyafiq avatar Mar 11 '26 07:03 janiussyafiq