# Environment variable interpolation in Logstash conf files

**URL:** <https://discuss.elastic.co/t/environment-variable-interpolation-in-logstash-conf-files/172411>\
**Category:** Logstash\
**Created:** [March 14, 2019, 7:36pm UTC](https://discuss.elastic.co/t/environment-variable-interpolation-in-logstash-conf-files/172411 "2019-03-14T19:36:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![01100010011001010110](https://avatars.discourse-cdn.com/v4/letter/0/0ea827/32.png) [@01100010011001010110](https://discuss.elastic.co/u/01100010011001010110)\
**Post date:** [March 14, 2019, 7:36pm UTC](https://discuss.elastic.co/t/environment-variable-interpolation-in-logstash-conf-files/172411/1 "2019-03-14T19:36:15Z")

</div>

We run logstash on k8s with centralized pipeline management, and I'm attempting to pass credentials into the containers as env vars. This has worked for everything but the `azure_eventhubs` input plugin. Debug logging seems to indicate that the `SAS_KEY` env var in this plugin:

```auto
azure_event_hubs {
      codec => "json"
      config_mode => "advanced"
      threads => 5
      decorate_events => true
      storage_connection => "DefaultEndpointsProtocol=https;AccountName=<account_name>;AccountKey=${STORAGE_KEY};EndpointSuffix=core.windows.net"
      event_hubs => [
        {"paas" => {
          event_hub_connection => "Endpoint=sb://<event_hub_namespace>.servicebus.windows.net/;SharedAccessKeyName=collector;SharedAccessKey=${SAS_KEY};EntityPath=paas"
          consumer_group => "logstash"
          storage_container => "azurelogscentralus-paas"
        }}
      ]
      add_field => {
        "[fields][logsource]" => "azure-paas"
      }
    }

```

is not interpolated, while the `STORAGE_KEY` var is. Does interpolation not go into nested structures like this?

---

<div class="post-metadata">

**Author:** ![01100010011001010110](https://avatars.discourse-cdn.com/v4/letter/0/0ea827/32.png) [@01100010011001010110](https://discuss.elastic.co/u/01100010011001010110)\
**Post date:** [March 27, 2019, 7:06pm UTC](https://discuss.elastic.co/t/environment-variable-interpolation-in-logstash-conf-files/172411/2 "2019-03-27T19:06:22Z")

</div>

The underlying cause for this ended up being that password configuration variables are passed to the interpolation function unwrapped, and since `Password` is not a String, the interpolation returned immediately.

[I filed a PR](https://github.com/elastic/logstash/pull/10583) to unwrap the password, interpolate, and return the rewrapped object, would appreciate it whenever someone from the elastic team has time to take a look.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 24, 2019, 7:06pm UTC](https://discuss.elastic.co/t/environment-variable-interpolation-in-logstash-conf-files/172411/3 "2019-04-24T19:06:24Z")

</div>

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