[syslog-ng] Syslog-ng and External variables

Robert Blayzor rblayzor.bulk at inoc.net
Mon Aug 29 14:34:12 CEST 2016


OS: FreeBSD 10.3
Syslog-ng:  3.7.3


I am trying to reference/use a OS level environment variable in my Syslog-Ng configuration. Everything I’ve read and tried, does not appear to work.

I have confirmed simple environment variables like HOSTNAME and PATH are there, but when trying to reference them using backticks, ie: `HOSTNAME` does not appear to work. According to the documentation, environment variables are imported. ie: “Tip The environmental variables of the host are automatically imported and can be used as global variables.”

But this does not appear to be the case. When I try referencing a known environment variable I get:

Error parsing rewrite expression, syntax error, unexpected KW_VALUE, expecting LL_IDENTIFIER or LL_STRING in /usr/local/etc/syslog-ng.conf at line 56, column 24:

rewrite r_host { set(`HOSTNAME`, value("HOST")); };



Or is there another easier way to override the HOST in all messages to be that of the actual servers hostname. (and not things like localhost, 127.0.0.1, etc)


TIA
 
--
Robert
inoc.net!rblayzor
XMPP: rblayzor.AT.inoc.net
PGP Key: 78BEDCE1 @ pgp.mit.edu






More information about the syslog-ng mailing list