[systemd-devel] [PATCH] journalctl: allow customizable output formats

Lennart Poettering lennart at poettering.net
Thu Oct 9 03:37:44 PDT 2014


On Thu, 09.10.14 09:58, Daniel P. Berrange (berrange at redhat.com) wrote:

> > Hmm, also, we already have a really bad formatter in place for the
> > journal catalog files (which only replaces @foo@ by the value of field
> > foo). We should probably use the same code for this new journalctl
> > formatter and the catalog code. In fact the catalog formatter could
> > really use some improvement...
> 
> Ok, I didn't know about the catalog files until now, so I'll
> investigate that and see what I can do about unifying the code
> for these two options.

That would be fantastic!

> Do you consider the catalog file format to be part of the stable
> ABI ?  ie, do we need to preserve support for @foo@  if we took
> the "%s{FOO}" approach ?

I figure the @xyz@ syntax needs to stay. I mean, I doubt this is
widely used yet (we never really advertised it that much), but then
again it has been in place for a while now. So I figure we should
change the catalog files we ship to the new syntax, but still
alternatively support the old syntax, but only in the catalog files...

> > Maybe something like this:
> > 
> > journalctl -O "%t %s{CODE_FILE}:%s{CODE_LINE} %d{_SOURCE_REALTIME_TIMESTAMP}"
> > 
> > or something like that, where %t would simply map to the timestamp,
> > and %s{} maps to a field name, and %d{} the same, but reformats the
> > field as timestamp, assuming it is a UNIX timestamp formatted as
> > number...
> > 
> > Or something like that...
> 
> Yep, that would work for me. I'll cook up another patch to demonstrate
> that approach along with catalog support.

Thanks! That'd be lovely!

> I'm about to be travelling for KVM Forum / LinuxCon so probably won't get
> a chance to send an updated patch for a week or two.

See you in Düsseldorf!

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list