Current Behavior
In apisix/plugins/syslog/init.lua, send_syslog_data builds its two error messages by concatenating the underlying error directly onto the message text, with no separator:
err_msg = "failed when initiating the sys logger processor".. err -- line 67
...
err_msg = "failed to log message" .. err -- line 76
err_msg is returned to the batch processor, which writes it verbatim to error.log (apisix/utils/batch-processor.lua, core.log.error("Batch Processor[", ..., "]: ", err)). The message and the real cause run together into one unreadable token, for example:
failed when initiating the sys logger processorconnection refused
failed to log messagebuffer overflow
Every other error string in the same code base uses a ": " separator (e.g. 'failed to open /dev/urandom: ' .. err, 'failed to loadstring: ' .. err).
Expected Behavior
The underlying error is separated from the message, consistent with the rest of the code base:
failed when initiating the sys logger processor: connection refused
failed to log message: buffer overflow
Error Logs
Not captured from a live run. The strings above are derived from the concatenation at lines 67 and 76 of apisix/plugins/syslog/init.lua on master.
Steps to Reproduce
- Enable the
syslog plugin on a route with host/port pointing at an unreachable syslog server, using sock_type: "tcp".
- Send a request through the route so the batch processor flushes.
- Read
logs/error.log and look at the Batch Processor[syslog logger] error line: the failure reason is glued to the message text with no separator.
Note: this is separate from #13969 (nil-index crash when logger init fails). It concerns only the formatting of the messages, and applies to the "failed to log message" path too.
Environment
- APISIX version (run
apisix version): 3.18.0 (master @ 3234caa)
- Operating system (run
uname -a): N/A (found by code inspection)
- OpenResty / Nginx version (run
openresty -V or nginx -V): N/A
- etcd version, if relevant: N/A
- APISIX Dashboard version, if relevant: N/A
- Plugin runner version, for issues related to plugin runners: N/A
- LuaRocks version, for installation issues: N/A
Current Behavior
In
apisix/plugins/syslog/init.lua,send_syslog_databuilds its two error messages by concatenating the underlying error directly onto the message text, with no separator:err_msgis returned to the batch processor, which writes it verbatim toerror.log(apisix/utils/batch-processor.lua,core.log.error("Batch Processor[", ..., "]: ", err)). The message and the real cause run together into one unreadable token, for example:Every other error string in the same code base uses a
": "separator (e.g.'failed to open /dev/urandom: ' .. err,'failed to loadstring: ' .. err).Expected Behavior
The underlying error is separated from the message, consistent with the rest of the code base:
Error Logs
Not captured from a live run. The strings above are derived from the concatenation at lines 67 and 76 of
apisix/plugins/syslog/init.luaon master.Steps to Reproduce
syslogplugin on a route withhost/portpointing at an unreachable syslog server, usingsock_type: "tcp".logs/error.logand look at theBatch Processor[syslog logger]error line: the failure reason is glued to the message text with no separator.Note: this is separate from #13969 (nil-index crash when logger init fails). It concerns only the formatting of the messages, and applies to the "failed to log message" path too.
Environment
apisix version): 3.18.0 (master @ 3234caa)uname -a): N/A (found by code inspection)openresty -Vornginx -V): N/A