By Jonathan Corbet
November 20, 2011
Certain topics, it seems, are just meant to stress-test the LWN comment
system; after the
unveiling of "the
Journal" on November 18, "the works of Lennart Poettering" will have to
be added to that list. Lennart (along with Kay Sievers) has clearly hit a
nerve with his latest proposal. There is probably
enough in this concept to upset just about anybody, but the Journal
deserves serious consideration, even if it represents a break from how
logging has been handled in the past.
Start with this 2010 quote from Andrew
Morton:
The kernel's whole approach to messaging is pretty haphazard and
lame and sad. There have been various proposals to improve the
usefulness and to rationally categorise things in way which are
more useful to operators, but nothing seems to ever get over the
line.
The point Lennart and Kay are trying to make is that "haphazard and lame
and sad" doesn't just apply to kernel messaging; it describes the approach
taken by Linux in general. Messages are human-readable strings chosen by
developers, often without a whole lot of thought. These messages may have
information useful to automated system monitoring tools, but their
free-form nature makes them hard to find and the information contained
therein hard to extract. A quick look at what goes on inside a tool like
logwatch makes it clear that, whatever their benefits may be, free-form
messages are not clean or easy for tools to deal with. The fact that
developers can (and do) change messages at any time does not help matters
either.
Messages are stored in flat files that makes them
hard to access, and they are subject to manipulation and editing by
attackers. There must be a better way.
The Journal may or may not be a better way, but it does incorporate a
number of interesting ideas - though some of them may be "interesting" in
the Chinese
curse sense. It is tied to systemd, which condemns it in some people's
eyes even before the rest of the proposal can be considered. But hooking
logging into systemd makes it easy to capture all messages from managed
services and get them to
their final resting place. It enables tricks like printing the last few
messages from a service when querying its status.
It also makes it possible for the Journal to verify
the source of many messages and to add a bunch of additional metadata to
those messages. From this point of view, at least, it looks like a more
robust way of dealing with system logging.
When this subject was discussed at the 2011
Kernel Summit, one of the most controversial points was the request that
developers attach
128-bit UUID values to most or all messages. Associating a unique
identifier with each type of message does make some sense. Users (or their
tools) can look up specific messages in a help database to learn what the
message really means and how they should respond. Translation mechanisms
can use the identifiers to localize messages. System monitoring utilities
can immediately recognize relevant events and respond to them. But, while
the value of the identifier is clear, there is still a lot of disagreement
over its practicability. It is not clear that developers will bother to
generate unique identifiers and to use them in a disciplined way.
All complaints about UUIDs were quickly overshadowed by another issue once
the full proposal was posted: one might charitably say that there is not,
yet, a consensus around the proposed new logfile format. In a sense, that
is unsurprising, since that format is deliberately undocumented and
explicitly subject to change at any time. But it is clearly a binary
format, and a reasonably complex one at that; each field of a log message
is stored separately, and there is a mechanism for compressing out
duplicated strings, for example. Binary-blob data is allowed as a part of
a log message. The Journal's format is clearly a significant departure
from the classic, all-text flat-file format used by Unix-like systems since
before many of us were born.
There is value in a new log format. Current log files quickly become large
and unwieldy; extracting useful information from them can be a slow and
painful task. The new format, beyond holding much more information,
promises to be space-efficient and very quick to answer queries like
"please give me all the disk error messages from the last day." System
administrators could probably find a way to get used to the new features of
this format in a hurry.
That said, the idea of using an undocumented binary file format for crucial
system logging data sets off alarms in the head of just about anybody who
has been managing systems for any period of time. The format isn't
"secret," of course, but we still should not have to reverse-engineer the
format of our logfiles from the Journal source. Unless it is very
carefully done, this kind of format could lose a lot of logging data as the
result of a relatively small corruption. If the file format really does
shift over time, recovery of information from older logfiles could become
difficult. It is not surprising that this proposal scares a lot of people;
there may have to be some significant changes before the Journal becomes
acceptable to a lot of system administrators.
In truth, it may make sense to separate systemd's role in the collection,
verification, and annotation of log data from the role of a backend
dedicated to distribution and storage of that data. The two tasks are
different, and not all sites have the same needs in this area. Mixing the
two risks limiting the usefulness of the Journal and muddying the debate
about the concept as a whole.
Tradition
This proposal is a request for comments; it has garnered no end of those.
What is interesting to see, though, is that a lot of these comments take
the form of "syslog has been good for Unix for 40 years, this proposal is
trying to change one of our grandest traditions." There is a lot to value
in the Unix tradition, but we do need to be careful about sticking to it
just because That's How Things Have Always Been Done. Even longstanding
mechanisms are subject to improvement. In the case of logging, it seems
fairly clear that what we have now is not a thing of timeless beauty. This
article will take no position on whether the Journal is the right way to
improve on Linux logging, but it will claim that the fact that people are
looking at this problem and that they are willing to make significant
changes to improve things is good for Linux as a whole.
For much of the history of the Linux system, the unwritten goal was
probably something like "let's make something that looks sort of like SunOS
4.x, but which is free, works on current hardware and has the rough edges
smoothed a
bit." That goal - implement something firmly within the Unix tradition -
served to unify Linux development for many years; in our own special way,
we were all pulling in the same direction. But that goal has long since
been met; there is no longer an obvious target for us to be chasing at this
point.
That means that we are heading ever more deeply into new and uncharted
territory;
Linux is increasingly doing things that no Unix-like system has done
before. In the absence of an obvious model, developers doing new things
will do them in new ways. The results include Android, KDE4, GNOME3, and,
yes, the collected works of Lennart Poettering. If the work is genuinely
new, it will look different from what we are used to. Some of this work
will certainly turn out to be a bad idea, while some of it will endure for
a very long time. But none of it will exist unless developers are willing
to take risks and rethink how things have always been done.
Unless a shinier SunOS 4.x is really all that we are after, we as a
community are desperately in need of people who are willing to stir things
up and try new things to solve problems. To restrict ourselves to what
Unix did is an almost certain way to share Unix's fate. We can do better
than that - indeed, we have done better than that - but, to do so, we need
to create an environment where developers are willing to take some
technical risks. Bad ideas need to be exposed as such whenever possible,
but ideas should not be shot down just because they do not preserve the way
our grandparents did things. The Journal may or may not turn into a
sensible option, but the process that creates things like the Journal is
one of the most important things we have.
(
Log in to post comments)