# Using environmnet variables for kafka output

**URL:** https://discuss.elastic.co/t/using-environmnet-variables-for-kafka-output/127073
**Category:** Beats
**Tags:** filebeat
**Created:** [April 6, 2018, 10:24am UTC](https://discuss.elastic.co/t/using-environmnet-variables-for-kafka-output/127073 "2018-04-06T10:24:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mruthyu](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mruthyu](https://discuss.elastic.co/u/mruthyu)
#### Post date: [April 6, 2018, 10:24am UTC](https://discuss.elastic.co/t/using-environmnet-variables-for-kafka-output/127073/1 "2018-04-06T10:24:51Z")

</div>

Following configuration is not working.

```auto
output.kafka:
  enabled: true
  **hosts: ["${KAFKA_HOST_1}", "${KAFKA_HOST_2}", "${KAFKA_HOST_3}"]**
  topic: ${KAFKA_TOPIC_NAME}

```

///  
Environment variables set as

export KAFKA\_HOST\_1="[host1.xxxxx.com:9092](http://host1.xxxxx.com:9092)"  
export KAFKA\_HOST\_2="[host2.xxxxx.com:9092](http://host2.xxxxx.com:9092)"  
export KAFKA\_HOST\_3="[host3.xxxxx.com:9092](http://host3.xxxxx.com:9092)"

///

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [April 6, 2018, 1:00pm UTC](https://discuss.elastic.co/t/using-environmnet-variables-for-kafka-output/127073/2 "2018-04-06T13:00:43Z")

</div>

How do you start the beat? Which version of filebeat are you using?

Is the same user running the beat as where you have set the env variables?

In you post above you have ``\*\*` stars before and after the config, I assume that is for bold and not in the config itself?

Note: I reformatted your post above to make the config more readable.

---

<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: [May 4, 2018, 1:00pm UTC](https://discuss.elastic.co/t/using-environmnet-variables-for-kafka-output/127073/3 "2018-05-04T13:00:57Z")

</div>

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