Host/port from environment variables
Hi I'm trying configure syslog-ng, I'd like to be able to use environment variables for host & port. I've tried the ones that work in the template formatter but it's not working (not suprisingly). Is there another way? destination d_my_dest { tcp("$(env MY_HOST)" port($(env MY_PORT)) # this doesn't work as you can't get env vars unless in a template tls(peer-verify(required-untrusted) ca_dir("/etc/syslog-ng/cert.d")) template(myTemplate)); }; Thanks
Hi, you can use backticks to refer to environment variables. I think these were introduced in 3.4. tcp(port(`MY_PORT`)) It can also use values defined within the configuration files using the @define pragma: @define MY_PORT 12345 Or something like that. -- Bazsi On Mon, Jul 13, 2015 at 8:44 AM, Peter Flood <info@whywouldwe.com> wrote:
Hi
I'm trying configure syslog-ng, I'd like to be able to use environment variables for host & port. I've tried the ones that work in the template formatter but it's not working (not suprisingly). Is there another way?
destination d_my_dest { tcp("$(env MY_HOST)" port($(env MY_PORT)) # this doesn't work as you can't get env vars unless in a template tls(peer-verify(required-untrusted) ca_dir("/etc/syslog-ng/cert.d")) template(myTemplate)); };
Thanks
______________________________________________________________________________ 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
Backticks work, thanks. On 13/07/2015 12:53, Scheidler, Balázs wrote:
Hi,
you can use backticks to refer to environment variables. I think these were introduced in 3.4.
tcp(port(`MY_PORT`))
It can also use values defined within the configuration files using the @define pragma:
@define MY_PORT 12345
Or something like that.
-- Bazsi
On Mon, Jul 13, 2015 at 8:44 AM, Peter Flood <info@whywouldwe.com <mailto:info@whywouldwe.com>> wrote:
Hi
I'm trying configure syslog-ng, I'd like to be able to use environment variables for host & port. I've tried the ones that work in the template formatter but it's not working (not suprisingly). Is there another way?
destination d_my_dest { tcp("$(env MY_HOST)" port($(env MY_PORT)) # this doesn't work as you can't get env vars unless in a template tls(peer-verify(required-untrusted) ca_dir("/etc/syslog-ng/cert.d")) template(myTemplate)); };
Thanks ______________________________________________________________________________ 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
______________________________________________________________________________ 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 (2)
-
Peter Flood
-
Scheidler, Balázs