Using environment variable to specify file paths in yml config file

Is it possible to use an environment variable to specify part of the file path in the *beat.yml configuration?

You can see what I'm trying to do here. Is there a way to make it work?

output.logstash:
  hosts: ["foobar.com:5044"]
  ssl.certificate_authorities: ['${%PROGRAMFILES(X86)}\Metricbeat\pki\ca.crt']
  ssl.certificate: '${%PROGRAMFILES(X86)}\Metricbeat\pki\metricbeat-client.crt'
  ssl.key: '${%PROGRAMFILES(X86)}\Metricbeat\pki\metricbeat-client.key'

I spotted the error as soon as I posted this topic. The environment variables contain a % that shouldn't be there. This works just fine:

output.logstash:
  hosts: ["foobar.com:5044"]
  ssl.certificate_authorities: ['${PROGRAMFILES(X86)}\Metricbeat\pki\ca.crt']
  ssl.certificate: '${PROGRAMFILES(X86)}\Metricbeat\pki\metricbeat-client.crt'
  ssl.key: '${PROGRAMFILES(X86)}\Metricbeat\pki\metricbeat-client.key'

The ability to embed environment variables is a cool feature!

Glad you found the solution and thanks for posting it for others.

This topic was automatically closed after 21 days. New replies are no longer allowed.