[systemd-devel] systemd-logger and external syslog daemon
rgerhards at hq.adiscon.com
Fri Mar 18 06:30:25 PDT 2011
On 03/18/2011 01:53 PM, Kay Sievers wrote:
> On Fri, Mar 18, 2011 at 08:19, Rainer Gerhards<rgerhards at hq.adiscon.com> wrote:
>>> -----Original Message-----
>>> From: Lennart Poettering [mailto:lennart at poettering.net]
>>> Sent: Thursday, March 17, 2011 10:38 PM
>>> To: Rainer Gerhards
>>> Cc: Michael Biebl; Andrey Borzenkov; systemd-
>>> devel at lists.freedesktop.org
>>> Subject: Re: [systemd-devel] systemd-logger and external syslog daemon
>>> On Thu, 17.03.11 08:38, Rainer Gerhards (rgerhards at hq.adiscon.com)
>>>>> You mean a new udev/dracut/systemd on an old kernel? The messages
>>>>> print would look a bit weird if they are used together with log msg
>>>>> timestamping the way the kernel does it, since the kernel doesn't
>>>>> recognize the prefix. (See Kay's post about this). But besides
>>>>> cosmetic issues nothing should really go wrong.
>>>>> (I wonder if we can find a nice way to detect whether the kernel is
>>>>> enough for this, so that we could strip the facility automatically
>>>>> older ones. Explcitily checking for kernel versions at runtime is
>>>>> though... I can't think of a good way though...)
>>>> Wouldn't it work to check if there is a "<PRI>" right at the start of
>>>> message? I think that it is actual user data would be extremely
>>>> so this should be a good enough indication. That way, we could pull
>>> the PRI
>>>> even without the kernel patch (but, granted, it is kind of an
>>> The question is how we can detect whether it is safe to write messages
>>> to kmsg with PRI values with more than 3 bits. 2.6.39 and above will be
>>> to handle that properly, even if you enable per-line printk kernel
>>> timestamping. On 2.6.38 only 3-bit-PRI values will look good if you use
>>> printk kernel timestamping.
>> Probably I misunderstood the answer to "what happens on a kernel without that
>> patch if a full PRI is written?". I understood the answer was "the PRI is
>> moved into the message".
>> So "<123>msg"
>> would actually become
>> "<1> [TS]<123>Msg"
>> From your answer I deduce this understanding is incorrect. So what will then
>> happen on kernels without that patch if printk is provided a message
That's what I understood and what I based my proposal on. In that case,
rsyslog can simply check if there is an additional priority. I just did
some quick PoC:
Looks like it works pretty well. So systemd could simply always write
the full priority and the syslogd would just need to check for the extra
header. If the syslogd is not capable of doing that, the message will
look a bit strange. But in that case, the priority is wrong in any case,
and so chances it will be properly routed are slim...
More information about the systemd-devel