Skip to content

bug: syslog error messages run together with the underlying error (missing separator) #13973

Description

@bhuvan-somisetty

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

  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 @ 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions