Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rsyslogd and characters #012 and #015

Tags:

rsyslog

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?

like image 861
user803422 Avatar asked Jul 07 '14 09:07

user803422


People also ask

What is rsyslogd used for?

rsyslog is capable of forwarding logs to remote servers. The configuration is relatively simple and makes it possible for Linux admins to centralize log files for archiving and troubleshooting.

What is rsyslogd process?

The rsyslogd daemon reads a socket and sends the message line to a destination that is specified by the /etc/rsyslog.conf configuration file. The rsyslogd daemon reads the configuration file when it is activated.

Does rsyslog have content filtering?

They allow to filter on any property, like HOSTNAME, syslogtag and msg. A list of all currently-supported properties can be found in the rsyslog properties documentation. With this filter, each property can be checked against a specified value, using a specified compare operation.

What is the name of the rsyslogd configuration file?

conf file is the main configuration file for the rsyslogd(8) which logs system messages on *nix systems. This file specifies rules for logging. For special features see the rsyslogd(8) manpage. Rsyslog.


1 Answers

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

like image 177
user803422 Avatar answered Sep 19 '22 14:09

user803422