# Setting Elasticsearch environment Variables

**URL:** <https://discuss.elastic.co/t/setting-elasticsearch-environment-variables/49688>\
**Category:** Elasticsearch\
**Created:** [May 10, 2016, 4:45pm UTC](https://discuss.elastic.co/t/setting-elasticsearch-environment-variables/49688 "2016-05-10T16:45:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michel\_Laporte](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@Michel\_Laporte](https://discuss.elastic.co/u/Michel_Laporte)\
**Post date:** [May 10, 2016, 4:45pm UTC](https://discuss.elastic.co/t/setting-elasticsearch-environment-variables/49688/1 "2016-05-10T16:45:57Z")

</div>

Hi,  
Quick Q.

How do i parse elasticsearch variables into the YML?

I need to put the IP for network.host dynamically for spawned slaves and ive set an environment variable like:

ip="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)"

Which returns just the IP address of Eth0 from my VM

And in the .yml File i've tried to allocate it to

network.host ${ip}

Yet this is not working. However, in [node.name](http://node.name) $(HOSTNAME} variable works?

I also need to set it for the cluster\_name also so any insight will really help.  
Thanks,  
Michel

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 11, 2016, 11:36pm UTC](https://discuss.elastic.co/t/setting-elasticsearch-environment-variables/49688/2 "2016-05-11T23:36:36Z")

</div>

Why not just use `network.host: _eth0_`, as per [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-network.html#network-interface-values](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-network.html#network-interface-values)

---

<div class="post-metadata">

**Author:** ![Michel\_Laporte](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@Michel\_Laporte](https://discuss.elastic.co/u/Michel_Laporte)\
**Post date:** [May 17, 2016, 8:37am UTC](https://discuss.elastic.co/t/setting-elasticsearch-environment-variables/49688/3 "2016-05-17T08:37:42Z")

</div>

Thanks man! That works 🙂

One more thing, when naming the index's we want to use "elasticsearch\_$date"

Where $date is the timestamp of the days date the index was created. Is there any way of parsing that to ES have the index prefix with "elasticsearch\_$date$"?

Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 17, 2016, 1:55pm UTC](https://discuss.elastic.co/t/setting-elasticsearch-environment-variables/49688/4 "2016-05-17T13:55:29Z")

</div>

You need to pass that into ES when you create the index, ES doesn't automatically convert that.

---

<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:** [July 5, 2017, 10:51pm UTC](https://discuss.elastic.co/t/setting-elasticsearch-environment-variables/49688/5 "2017-07-05T22:51:09Z")

</div>


