2

My NodeJS-based service writes multiline logs using console.log to journald. However, logs get broken down on each new line (\n). How can I have a multiline message in a single log entry?

Thank you!

1 Answer 1

0

Newer version or rsyslog (> 8.0 I think) add a configuration option to stop this behavior of converting newlines into \n characters. But because rsyslog is text-based, you can't achieve what you want until you break multiple lines into individual log entries using your own log formatter.

I recommend considering using system journal (journad) which handles newlines as you'd expect. More than that, it allows structured logging. This way, you can send your stacktraces and exception classes or codes into individual fields for easy filtering.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .