syslog: strip empty trailing newlines

for unknown reasons, syslog messages are getting generating with
newlines in the end. we then try to parse this empty string as a
syslog message and fail
This commit is contained in:
Girish Ramakrishnan
2025-02-27 11:16:52 +01:00
parent 558620cdfa
commit 063b102461

View File

@@ -53,7 +53,7 @@ async function start() {
gServer.on('connection', function (socket) {
socket.on('data', function (data) {
const msg = data.toString('utf8');
const msg = data.toString('utf8').trim(); // strip any trailing empty new lines
for (const line of msg.split('\n')) { // empirically, multiple messages can arrive in a single packet
const info = parseRFC5424Message(line);
if (!info) return debug('Unable to parse:', msg);