rsyslogd and characters #012 and #015
Asked Answered
P

1

17

I use rsyslogd version 5.8. The characters \n and \r are dumped as #012 and #015 in the log file.

Example (by entering command: printf "example-test[\r]" | logger) :

<13> 2014-07-07T11:01:03.254 root:  example-test[#015]

I would rather like to dump them in hexadecimal: #0A and #0D (or other more human-readable format).

How could I do this by modifying the rsyslogd configuration file?

Paynter answered 7/7, 2014 at 9:2 Comment(0)
P
13

After reading the source code of rsyslogd versions 5.8.3 and 7.6.0, it appears that :

  • the hexadecimal base cannot be used, as the octal base (#012, #015) is hard-coded.
  • the escaping can be turned on or off: parameters $EscapeControlCharactersOnReceive and $Escape8BitCharactersOnReceive

The documentation confirms that:

https://www.rsyslog.com/doc/v7-stable/configuration/input_directives/rsconf1_escapecontrolcharactersonreceive.html

https://www.rsyslog.com/doc/v7-stable/configuration/input_directives/rsconf1_escape8bitcharsonreceive.html

Paynter answered 18/7, 2014 at 6:45 Comment(1)
Note: turning on this option most probably destroys non-western character sets (like Japanese, Chinese and Korean) and it destroys digital signatures if such exists inside the message. Also the drop-cc, space-cc and escape-cc property replacer options do not work as expected because control characters are already removed upon message reception. If you intend to use these property replacer options, you must turn off $EscapeControlCharactersOnReceive.Fumigant

© 2022 - 2024 — McMap. All rights reserved.