0

I am trying to manipulate how Rsyslog sends data to a syslog server on an embedded system that runs Rsyslog version 5. As it is an embedded system there is no option to upgrade to a later version without vendor involvement.

I have the following template:

 $template precise,": %HOSTNAME%-dev123: %timegenerated%: %syslogfacility-text%-%syslogpriority%-%syslogtag%%msg%"

In the above example, the text '123' is a serialised asset number that identifies the device. This number is stored in a file and I would like to dynamically fetch this rather than hard-code it to make the rsyslog config more universal and portable within our environment.

As it is pre-version6, advanced templates are not supported that would allow for command substition.

Is there a method available in this version of rsyslog to allow me to do this?

fileinsert
  • 136
  • 1
  • 6
  • The v5 documentation is [here](https://www.rsyslog.com/doc/v5-stable/configuration/templates.html). I don't see any way to do what you want in the middle of a template string. You could `$IncludeConfig` a file, but it would have to contain a complete line. The simplest solution is to use some other tool to edit the .conf file before starting rsyslog. – meuh Mar 06 '21 at 19:06
  • Yeah... that's the conclusion I had come to, and your suggestion is exactly what happens today. I have no influence over the vendor and their firmware. Looks like I'm stuck with what I've got. – fileinsert Mar 06 '21 at 20:12

0 Answers0