[systemd-devel] Multiline log mesages in journal

Marti Raudsepp marti at juffo.org
Wed Mar 14 11:54:36 PDT 2012


On Wed, Mar 14, 2012 at 20:10, Lennart Poettering
<lennart at poettering.net> wrote:
> I think I would prefer if do not repeat the the meta data in the output,
> and just output the actual message, line-by-line, prefixed with
> whitespace. So that we'd get this:
>
> Mar 07 12:23:57 host postgres[6326]: line1
>                                     line2

Yeah, that seems like a better idea. I guess we should do the same
thing in verbose output mode.

> Does PostgreSQL actually write those multi-line messages into syslog
> datagrams? interesting i must say, I didn't expect that people do that

No, currently it sends a separate syslog message for each line. But I
wrote a PostgreSQL module to send messages directly to journal (since
there's a lot of useful context information that gets lost with
syslog) and was wondering how to handle multiline messages:
https://github.com/intgr/pg_journal/blob/master/doc/pg_journal.md

> The display routines for those messages could use some love
> probably. For example, I know a couple of services which log messages
> with tabs in them.
> Also, we recently added functions to check utf8 validity of strings to
> systemd.

Yeah, I took a stab at the message printing code and concluded that it
needs to be rewritten anyway if we want to handle non-ASCII messages
right:
* validating UTF-8 in messages (depending on locale)
* making sure that ellipsize doesn't corrupt multibyte UTF-8 chars
* expand tabs, as you pointed out
* double-width Unicode characters (e.g. み takes up two terminal columns)
* newline handling

Maybe we should give up on ellipsize and just let 'less -S' do the
work. That would avoid a lot of complexity with width-counting.

Regards,
Marti


More information about the systemd-devel mailing list