Skip to content

Conversation

@Revolyssup
Copy link
Contributor

@Revolyssup Revolyssup commented Nov 21, 2024

Description

Problem description
The customer uses the kafka-logger plug-in and configures max_req_body_bytes and max_resp_body_bytes respectively, and the sizes of the request and response bodies exceed the configured values. However, in the log content actually uploaded to kafka, the response body is truncated, but the request body is not truncated. Perform truncation.

Reproduction steps
Configure plugin_metadata for kafka-logger and set a custom log format. The log format contains $request_body
Enable the kafka-logger plug-in in the global plug-in or route or service, and configure max_req_body_bytes and max_resp_body_bytes
The client initiates a request, the request body size is greater than max_req_body_bytes, and hits the kafka-logger plug-in
Viewing the log in kafka, you can see that the content of request_body is the complete request body and is not truncated.

Fix: Make sure the field is used in custom_format as well

Fixes # (issue)

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Nov 21, 2024
@Revolyssup Revolyssup merged commit e38dab1 into apache:master Nov 22, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants