[hostlogger] Trailing LF is dropped from host logger to rsyslog

Heyi Guo guoheyi at linux.alibaba.com
Mon Feb 28 12:26:48 AEDT 2022


Finally, I found this feature is controlled by the global option: 
DropTrailingLFOnReception. After setting it off, the tailing LF will not 
be dropped any more.

$DropTrailingLFOnReception off

Thanks,

Heyi

在 2022/2/25 下午5:25, Heyi Guo 写道:
>
> 在 2022/2/25 下午5:24, Heyi Guo 写道:
>> Hi Spencer,
>>
>> Thanks for your info; I check my configuration file and it is almost 
>> the same with the one you post, except for below items:
>>
>> - SysSock.Use="off"
>>
>> - UseSpecialParser="off"
>>
>> - ParseHostname="off"
>>
>>
>> However the trailing LF of each transfer is still dropped in the 
>> target file.
>
> I mean the issue is still there after adding the above 3 items to 
> configuration file.
>
> Heyi
>
>>
>> Any other ideas?
>>
>> PS: We are using the version of rsyslog from openbmc 2.10.0-rc1.
>>
>> Thanks,
>>
>> Heyi
>>
>>
>> 在 2022/2/25 下午5:00, Spencer Ku (古世瑜) 写道:
>>> 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