Skip to content

Conversation

@nic-6443
Copy link

@nic-6443 nic-6443 commented Jan 12, 2026

When using UDP as the transport protocol, due to the payload size limitation of UDP (65507), if there is a log line that exceeds this size limit and attempts to send, _do_flush call fails withEMSGSIZE. However, since send_buffer is not reset, all subsequent logs will still include the previous oversized log when sent again, causing continuous errors.
refs:

self.send_buffer = self.send_buffer .. packet

bytes, err = _do_flush(self)

nic-6443 and others added 2 commits January 12, 2026 16:37
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
@membphis
Copy link

according this:

image

I think we need to control the max payload size, change some code about this

but we only change this line:
image

pls confirm you submit all of the relation code, it confused me

@nic-6443
Copy link
Author

nic-6443 commented Jan 12, 2026

@membphis @shreemaan-abhishek

I think we need to control the max payload size

This lib already has such a feature, flush_limit is used to control the buffer to write logs into the socket when it reaches a certain size:

flush_limit = 4096, -- 4KB
drop_limit = 1048576, -- 1MB
. But the current problem is that in abnormal scenarios, a single log exceeds the limit of the UDP protocol.

By the way, we also cannot split the data here and send it multiple times because the log data itself has an encoding protocol.
https://github.com/apache/apisix/blob/bcf0c044d573ac9a0bfed07746728b31253b46e5/apisix/plugins/syslog/init.lua#L89-L90
If it is sent dispersed across multiple UDP sockets, it will become multiple logs on the syslog server side.

The main cause of this issue is that the user enabled the collection of request body and response body while using APISIX's syslog plugin, but did not set a size limit (we have informed the user to configure this limit). This caused the syslog plugin to attempt to use this library to send data exceeding the UDP protocol limit. Due to the bug mentioned in the PR description, it further led to subsequent logs that conform to protocol size also being unable to be sent.

@shreemaan-abhishek shreemaan-abhishek merged commit ea03d89 into master Jan 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants