Skip to contentSkip to conversation

Trailing LF is dropped from host logger to rsyslog

hostlogger Heyi Guo 2 participants 5 messages Feb 25, 2022 – Feb 28, 2022

lore
Share & tools
lore

Heyi Guo

author
#0 lore raw

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

#1 lore raw

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

Quoted 30 lines

-----Original Message-----
From: openbmc <[email protected]> On Behalf Of Heyi Guo
Sent: Friday, February 25, 2022 4:07 PM
To: openbmc <[email protected]>
Cc: Alexander Amelkin <[email protected]>; Artem Senichev <[email protected]>; Alexander Filippov <[email protected]>
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

author
#2 lore raw

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.

Any other ideas?

PS: We are using the version of rsyslog from openbmc 2.10.0-rc1.

Thanks,

Heyi

Quoted 58 lines · 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

Quoted 30 lines

-----Original Message-----
From: openbmc <[email protected]> On Behalf Of Heyi Guo
Sent: Friday, February 25, 2022 4:07 PM
To: openbmc <[email protected]>
Cc: Alexander Amelkin <[email protected]>; Artem Senichev <[email protected]>; Alexander Filippov <[email protected]>
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

author
#3 lore raw
Quoted 4 lines · 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:

Quoted 8 lines

- 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

Quoted 69 lines

Any other ideas?

PS: We are using the version of rsyslog from openbmc 2.10.0-rc1.

Thanks,

Heyi

Quoted 58 lines · 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

Quoted 30 lines

-----Original Message-----
From: openbmc <[email protected]> On Behalf Of Heyi Guo
Sent: Friday, February 25, 2022 4:07 PM
To: openbmc <[email protected]>
Cc: Alexander Amelkin <[email protected]>; Artem Senichev <[email protected]>; Alexander Filippov <[email protected]>
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

author
#4 lore raw

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

Quoted 88 lines · Heyi Guo
Quoted 4 lines · 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:

Quoted 8 lines

- 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

Quoted 69 lines

Any other ideas?

PS: We are using the version of rsyslog from openbmc 2.10.0-rc1.

Thanks,

Heyi

Quoted 58 lines · 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

Quoted 30 lines

-----Original Message-----
From: openbmc <[email protected]> On Behalf Of Heyi Guo
Sent: Friday, February 25, 2022 4:07 PM
To: openbmc <[email protected]>
Cc: Alexander Amelkin <[email protected]>; Artem Senichev <[email protected]>; Alexander Filippov <[email protected]>
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