[syslog-ng] runtime definition of a constant

Evan Rempel erempel at uvic.ca
Thu Apr 24 00:57:20 CEST 2014


I have a use case where I want to preface every message from a source with some kind of instance name.
It would be easy to create a static template, but I would like to be able to use the same configuration include
on all of the hosts and provide the "instance" name from a local configuration space.

Is there any way to do this kind of thing


@module confgen context(root) name(myinstance) exec("/bin/cat /path/to/instance/file")

@define instance "myinstance()"

template t_mytemplate     { template("<$pri>$parsedate $parsehost ldap: `instance`: $parsemessage\n"); template_escape(no); };



or if the confgen could have a template context

@module confgen context(template) name(myinstance) exec("/bin/cat /path/to/instance/file")

template t_mytemplate     { template("<$pri>$parsedate $parsehost ldap: $(myinstance): $parsemessage\n"); template_escape(no); };





Evan.


More information about the syslog-ng mailing list