apisix icon indicating copy to clipboard operation
apisix copied to clipboard

feat: add max request and response body size attributes to http-logger plugin

Open MariaLapovska opened this issue 1 year ago • 5 comments

Description

In some cases APISIX users might want to customize the max size of request/response body sent to HTTP server via http-logger plugin to be lower/higher than the current default value of 512KiB.

kafka-logger plugin already supports max_resp_body_bytes and max_req_body_bytes attributes, so I followed the example and added them in this PR.

MariaLapovska avatar Apr 10 '25 00:04 MariaLapovska

Hi @Baoyuantop ! I've created the issue for this PR per your request

MariaLapovska avatar Apr 14 '25 18:04 MariaLapovska

From the current code, these properties are defined in public functions with https://github.com/apache/apisix/pull/11133

It looks like other log-like plugins can configure these settings directly, but for APISIX, do we need to standardize the documentation of other log plugins and add relevant tests?

Baoyuantop avatar May 19 '25 03:05 Baoyuantop

@Baoyuantop don't max_req_body_bytes and max_resp_body_bytes need to be defined in the logging plugins schemas to actually be evaluated?

MariaLapovska avatar May 23 '25 23:05 MariaLapovska

The schema of these plugins does not define additionalProperties = false, which means that you can add these properties directly in the plugin's configuration, but this behavior is untested and may have unexpected problems.

So I think it's still recommended to supplement the corresponding documentation and tests.

Baoyuantop avatar May 26 '25 02:05 Baoyuantop

@Baoyuantop is this issue resolved? bcs currently i'm working on it. my plan is to add both attributes to each logger defined in APISIX (19 in total if not mistaken), but for each logger plugin should i add test cases just like in this PR (https://github.com/apache/apisix/pull/11133/changes#diff-f3e71a8e97b76235c917335136683b5b10512a42140191c90529e5077f4e0604R1)? wdyt

janiussyafiq avatar Feb 24 '26 09:02 janiussyafiq