# 5.2.x environment variables bug?

**URL:** <https://discuss.elastic.co/t/5-2-x-environment-variables-bug/96482>\
**Category:** Logstash\
**Created:** [August 9, 2017, 4:53pm UTC](https://discuss.elastic.co/t/5-2-x-environment-variables-bug/96482 "2017-08-09T16:53:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bghoang](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@bghoang](https://discuss.elastic.co/u/bghoang)\
**Post date:** [August 9, 2017, 4:53pm UTC](https://discuss.elastic.co/t/5-2-x-environment-variables-bug/96482/1 "2017-08-09T16:53:00Z")

</div>

I've been trying to get environment variables to work in 5.2.x, but no matter how I try to set them Logstash does not recognize them.

I've tried setting up them up as permanent system environment variables, and I also tried adding them the /etc/default/logstash. But, logstash does not see the variables when it's running as a service, nor does it work if I run logstash directly bin/logstash -f /path/logs.conf

But, if I upgrade to 5.5.x, things start to work in these cases...  
Logstash running as a service pipeline, the variables are read from /etc/defaults/logstash

Logstash from the commandline bin/logstash -f /path/logs.conf, the variables are read from the linux system environment variables.

So, a few questions:

1. Can someone please confirm if this is a defect with 5.2.x?
2. If this is not a defect in 5.2.x, then what am I doing wrong? How do I get this to work with 5.2.x?

Upgrading to 5.5.x is NOT a preferred path to resolve this unless there is absolutely no workable solution in 5.2.x.

My company requires a lengthy upgrade approval process, which we don't want to deal with right now, so if there's a workable solution for 5.2.x please point me to it.

If it's a defect that is only resolved in later versions of logstash please let me know.

---

<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:** [September 6, 2017, 4:53pm UTC](https://discuss.elastic.co/t/5-2-x-environment-variables-bug/96482/2 "2017-09-06T16:53:01Z")

</div>

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