bhuvan-somisetty opened a new issue, #13973:
URL: https://github.com/apache/apisix/issues/13973
### 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:
```lua
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
1. Enable the `syslog` plugin on a route with `host`/`port` pointing at an
unreachable syslog server, using `sock_type: "tcp"`.
2. Send a request through the route so the batch processor flushes.
3. 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 @ 3234caa2)
- 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]