# Pass Envt Variables to Logstash config file

**URL:** <https://discuss.elastic.co/t/pass-envt-variables-to-logstash-config-file/250375>\
**Category:** Logstash\
**Created:** [September 29, 2020, 2:23pm UTC](https://discuss.elastic.co/t/pass-envt-variables-to-logstash-config-file/250375 "2020-09-29T14:23:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [September 29, 2020, 2:23pm UTC](https://discuss.elastic.co/t/pass-envt-variables-to-logstash-config-file/250375/1 "2020-09-29T14:23:36Z")

</div>

Hello Team

I am having Logstash v7.8.0 installed along with Elasticsearch v7.8.0.

My Requirement is

1. to run multiple logstash instances using pipelines via individual "conf" files.

2. These conf files , are having variables which are unique across the executions and I need to set them before running logstash.

3. My Logstash will run with the help of scheduler in interval of time period say 1 hour.

I am not able to achieve : to have variables set before scheduler hitting logstash to read "conf" file and run it.

I am using shell script to be executed before logstash runs.. but its not working.

How to run shell script via logstash pipeline so that , I can have variables in respective "conf" files only and multiple times as its a scheduler run throughout the day.

Thanks  
Tushar Nemade

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 29, 2020, 2:24pm UTC](https://discuss.elastic.co/t/pass-envt-variables-to-logstash-config-file/250375/2 "2020-09-29T14:24:59Z")

</div>

Try putting your env vars in /etc/default/logstash

---

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [September 29, 2020, 2:29pm UTC](https://discuss.elastic.co/t/pass-envt-variables-to-logstash-config-file/250375/3 "2020-09-29T14:29:36Z")

</div>

Hello

I have configure logstash in my folder, its not rpm installation.

Could you please help me where i can save my variables in manual installation..

And do i need to same then in a file ? and what should be name and how to call it in execution..

Thanks  
Tushar Nemade

---

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [September 29, 2020, 3:12pm UTC](https://discuss.elastic.co/t/pass-envt-variables-to-logstash-config-file/250375/4 "2020-09-29T15:12:25Z")

</div>

Hello

I understand now , the file itself is /etc/default/logstash.

My another query is , if I am having dynamic variable values ,which are changing as per every 1 hour of duration .. and logstash is running multiple instances via its own input plugin -\> elasticsearch --\> scheduler ... making sure /etc/default/logstash file is updated with latest variable will be a challenge in non-ideal / error situation.

If there any way we can have shell script executed before logstash starts input / filter / output stuff from its conf file.

Thanks  
Tushar Nemade

---

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [September 30, 2020, 3:46am UTC](https://discuss.elastic.co/t/pass-envt-variables-to-logstash-config-file/250375/5 "2020-09-30T03:46:18Z")

</div>

Hi

Can someone please help me..

Thanks  
Tushar Nemade

---

<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:** [October 28, 2020, 3:46am UTC](https://discuss.elastic.co/t/pass-envt-variables-to-logstash-config-file/250375/6 "2020-10-28T03:46:25Z")

</div>

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