[hostlogger] Trailing LF is dropped from host logger to rsyslog
Spencer Ku (古世瑜)
Spencer.Ku at quantatw.com
Fri Feb 25 20:00:53 AEDT 2022
Hi Heyi,
Phosphor-hostlooger in stream mode forwards the byte stream into rsyslog via the imuxsock module. The log is persisted via the omfile module as soon as collected.
So we need to use imuxsock module to transfer the data. The below sample is my rsyslog settings:
module(load="imuxsock" SysSock.Use="off")
template(name="ConsoleTemplate" type="string" string="%rawmsg%")
ruleset(name="ConsoleRuleset") {
action(type="omfile" file="/var/log/console/log" template="ConsoleTemplate")
}
# Custom socket for serial console logs.
input(type="imuxsock"
Socket="/run/rsyslog/console_input"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleRuleset")
$EscapeControlCharactersOnReceive off
And we also need to set the socket path to hostlogger config(STREAM_DST). In this sample, the path is /run/rsyslog/console_input
Hope this information is helpful to you.
Sincerely,
Spencer Ku
> -----Original Message-----
> From: openbmc
> <openbmc-bounces+spencer.ku=quantatw.com at lists.ozlabs.org> On Behalf Of
> Heyi Guo
> Sent: Friday, February 25, 2022 4:07 PM
> To: openbmc <openbmc at lists.ozlabs.org>
> Cc: Alexander Amelkin <a.amelkin at yadro.com>; Artem Senichev
> <a.senichev at yadro.com>; Alexander Filippov <a.filippov at yadro.com>
> Subject: [hostlogger] Trailing LF is dropped from host logger to rsyslog
>
> Hi all,
>
> We are using hostlogger in stream mode and forwarding the serial port data to
> rsyslog. rsyslog template is as below:
>
> $EscapeControlCharactersOnReceive off
>
> template(name="hostlog" type="string"
> string="%rawmsg%"
> )
>
> However it seems the trailing LF "\n" of each socket transfer will be dropped
> when saving the messages to file, causing multiple lines joined together and
> hard to read.
>
> Is there anything wrong in our configuration?
>
> Thanks,
>
> Heyi
More information about the openbmc
mailing list