# Setting Env Variables in logstash configuration files

**URL:** <https://discuss.elastic.co/t/setting-env-variables-in-logstash-configuration-files/320341>\
**Category:** Logstash\
**Created:** [December 2, 2022, 8:47am UTC](https://discuss.elastic.co/t/setting-env-variables-in-logstash-configuration-files/320341 "2022-12-02T08:47:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [December 2, 2022, 8:47am UTC](https://discuss.elastic.co/t/setting-env-variables-in-logstash-configuration-files/320341/1 "2022-12-02T08:47:29Z")

</div>

Hello All,

I would like to know how can I set up Env Variable in logstash pipleline.yml to read config files  
from particular folder when logstash startup.

Directory structure:  
C-\>Logstash-\>cfg-\>Different config files

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/1/e1a6e01054d4f6bcf23b2deb67a5e062bcfbb195.png)

Thanks

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [December 2, 2022, 1:53pm UTC](https://discuss.elastic.co/t/setting-env-variables-in-logstash-configuration-files/320341/2 "2022-12-02T13:53:59Z")

</div>

I'm not sure I understand the question about environment variables, but in `pipelines.yml` you can configure the path where the config files for the pipeline are.

Something like:

```auto
- pipeline.id: pipeline-name
  path.config: "/path/to/config/files/*.cfg"

```

---

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [December 2, 2022, 2:07pm UTC](https://discuss.elastic.co/t/setting-env-variables-in-logstash-configuration-files/320341/3 "2022-12-02T14:07:49Z")

</div>

Hello,

Here for below constant path I need env variable defined.Is this possible and how would config look like?  
/path/to/config/files

Does below config is valid in pipelines.yml ?

```auto
- pipeline.id: mydatabasestate
  queue.type: persisted
  path.config: "${PIPELINES_CONFIG}/*.cfg"

```

Many Thanks

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [December 2, 2022, 2:52pm UTC](https://discuss.elastic.co/t/setting-env-variables-in-logstash-configuration-files/320341/4 "2022-12-02T14:52:17Z")

</div>

I don't think this is supported.

Did you test it?

---

<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:** [December 30, 2022, 2:53pm UTC](https://discuss.elastic.co/t/setting-env-variables-in-logstash-configuration-files/320341/5 "2022-12-30T14:53:00Z")

</div>

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