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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user