Injecting environment variables?
New to the list, but looking for some pointers: It is possible to get shell variables interpreted and defined in the context of the syslog-ng.conf file? I'm trying to get the value from a shell/environment variable to be added to a logged message. I've tried various forms of templates in the destination without much success. template("<$PRI> $DATE $HOST $MSG $someENVvar \n") template_escape(no)); Static text works find, but the var ends up being blank... For reasons I won't belabor, I can't use tags as added by the source. Apologies if this has been covered previous - I didn't see anything from scanning the archives. Thanks. Jim.
Hi Jim, As of version 3.5 you can use the `env` template function: template("<$PRI> $DATE $HOST $MSG $(env <environment-variable>) \n") template_escape(no)); Cheers
Earlier you could use the backtick env variable format. This one is substituted at config parsing. On Sep 18, 2014 5:26 PM, "Fabien Wernli" <wernli@in2p3.fr> wrote:
Hi Jim,
As of version 3.5 you can use the `env` template function:
template("<$PRI> $DATE $HOST $MSG $(env <environment-variable>) \n") template_escape(no));
Cheers
______________________________________________________________________________ Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng FAQ: http://www.balabit.com/wiki/syslog-ng-faq
participants (3)
-
Balazs Scheidler
-
Fabien Wernli
-
jetjnkr@gmail.com