Conditionals for Elasticsearch output configurations?

I'm trying to do something like the following:

ssl.certificate_authorities:
  - C:\Users\Administrator\Documents\elastic-agent\fleet.crt
    condition: ${host.platform} == "windows"
  - /etc/ssl/certs/fleet.crt
    condition: ${host.platform} == "linux"

Essentially... if the Elastic Agent is on a Windows machine.. it will search for the location of the certificate in the top location.. or linux vice versa.

This is just a pseudo example.. wondering what the correct way of doing this is :slight_smile: Thanks!

hey @dmitryyankowski
you cannot apply condition on array items but maybe you can do something like this

    elasticsearch.ssl:
      certificate_authorities:
        - C:\Users\Administrator\Documents\elastic-agent\fleet.crt
      condition: ${host.platform} == "windows"
    elasticsearch.ssl:
      certificate_authorities:
        - /etc/ssl/certs/fleet.crt
      condition: ${host.platform} != "windows"

you need to specify this in an outputs section when using standalone and it should also work if you specify it in Settings->Elasticsearch output configuration section in fleet

I think at the moment conditions on outputs is not supported.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.