# Environment variable syntax problems for beats monitoring

**URL:** https://discuss.elastic.co/t/environment-variable-syntax-problems-for-beats-monitoring/205867
**Category:** Beats
**Created:** [October 30, 2019, 1:27pm UTC](https://discuss.elastic.co/t/environment-variable-syntax-problems-for-beats-monitoring/205867 "2019-10-30T13:27:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sgreszcz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sgreszcz/32/46322_2.png) [@sgreszcz](https://discuss.elastic.co/u/sgreszcz)
#### Post date: [October 30, 2019, 1:27pm UTC](https://discuss.elastic.co/t/environment-variable-syntax-problems-for-beats-monitoring/205867/1 "2019-10-30T13:27:56Z")

</div>

I'm trying to pass through the monitoring elasticsearch cluster hostname as an enterprise variable and set in the metricbeat.yml and filebeat.yml. The variable is:

`MONITORING_ELASTICSEARCH=elk-001`

Hardcoding the name works like this:

```
monitoring:
  enabled: true
  elasticsearch:
    hosts: ["elk-001"]

```

I've tried these syntaxes for the enterprise variable, but none of them work, and the documentation is not too clear: [https://www.elastic.co/guide/en/beats/filebeat/current/using-environ-vars.html](https://www.elastic.co/guide/en/beats/filebeat/current/using-environ-vars.html)

```
monitoring:
  enabled: true
  elasticsearch:
    hosts: ["$elk-001"] or hosts: ${elk-001}

```

or many others but it doesn't work.

---

<div class="post-metadata">

### Author: ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)
#### Post date: [October 31, 2019, 8:34am UTC](https://discuss.elastic.co/t/environment-variable-syntax-problems-for-beats-monitoring/205867/2 "2019-10-31T08:34:57Z")

</div>

Have you tried

```auto
monitoring:
  enabled: true
  elasticsearch.hosts: '$MONITORING_ELASTICSEARCH'

```

?

---

<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: [November 28, 2019, 10:46am UTC](https://discuss.elastic.co/t/environment-variable-syntax-problems-for-beats-monitoring/205867/3 "2019-11-28T10:46:02Z")

</div>

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