# The right way to specify environment?

**URL:** https://discuss.elastic.co/t/the-right-way-to-specify-environment/77204
**Category:** Logstash
**Created:** [March 2, 2017, 6:34pm UTC](https://discuss.elastic.co/t/the-right-way-to-specify-environment/77204 "2017-03-02T18:34:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ybizeul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ybizeul/32/16032_2.png) [@ybizeul](https://discuss.elastic.co/u/ybizeul)
#### Post date: [March 2, 2017, 6:34pm UTC](https://discuss.elastic.co/t/the-right-way-to-specify-environment/77204/1 "2017-03-02T18:34:18Z")

</div>

I'm trying to figure out how I am supposed to setup a consistent environment for logstash to startup correctly.

```auto
# /usr/share/logstash/bin/system-install 
Successfully created system startup script for Logstash

```

Looks good, but when I run :

```auto
Mar 02 13:29:04 adva logstash[15141]: Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.

```

If I fix `/etc/default/logstash` to include `JAVA_HOME` then the service starts correctly

Now, the problem is each time I run `system-install` it blows up `/etc/default/logstash` which is now empty, and logstash doesn't start anymore.

My startup.options contains these non empty/comment lines :

```auto
JAVACMD=/usr/local/nabox/java/bin/java
LS_HOME=/usr/share/logstash
LS_SETTINGS_DIR=/opt/logstash/etc
LS_OPTS="--path.settings ${LS_SETTINGS_DIR}"
LS_JAVA_OPTS=""
LS_PIDFILE=/var/run/logstash.pid
LS_USER=logstash
LS_GROUP=logstash
LS_GC_LOG_FILE=/var/log/logstash/gc.log
LS_OPEN_FILES=16384
LS_NICE=19
SERVICE_NAME="logstash"
SERVICE_DESCRIPTION="logstash"

```

It has every information needed to create a workable startup script but is missing something obviously. What am I doing wrong? Is there something I can put here that would end up declaring `JAVA_HOME` corectly in `/etc/default/logstash`

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [March 2, 2017, 7:01pm UTC](https://discuss.elastic.co/t/the-right-way-to-specify-environment/77204/2 "2017-03-02T19:01:14Z")

</div>

You are probably hitting [https://github.com/elastic/logstash/issues/6482](https://github.com/elastic/logstash/issues/6482), which has been fixed and will be released in 5.3.0.

---

<div class="post-metadata">

### Author: ![ybizeul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ybizeul/32/16032_2.png) [@ybizeul](https://discuss.elastic.co/u/ybizeul)
#### Post date: [March 2, 2017, 7:07pm UTC](https://discuss.elastic.co/t/the-right-way-to-specify-environment/77204/3 "2017-03-02T19:07:42Z")

</div>

Yes, looks like a match!

I'll test it again on 5.3 then, any ETA?

Thank you

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [March 2, 2017, 8:07pm UTC](https://discuss.elastic.co/t/the-right-way-to-specify-environment/77204/4 "2017-03-02T20:07:29Z")

</div>

Should be shortly after the 15th of March.

---

<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: [March 30, 2017, 8:07pm UTC](https://discuss.elastic.co/t/the-right-way-to-specify-environment/77204/5 "2017-03-30T20:07:41Z")

</div>

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