# Running logstash in the background in production environment

**URL:** <https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913>\
**Category:** Logstash\
**Created:** [August 4, 2017, 3:30pm UTC](https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913 "2017-08-04T15:30:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shroh](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@shroh](https://discuss.elastic.co/u/shroh)\
**Post date:** [August 4, 2017, 3:30pm UTC](https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913/1 "2017-08-04T15:30:46Z")

</div>

Hi,

I think i am having difficulty on starting logstash as a service which runs continuously in the background to read all the config files under the directory /etc/logstash/conf.d/

Although when i run it like /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/first.conf , it works fine and does what is written in the config file. But in the production environment, the service has to continously run and keep loading the files present in /etc/logstash/confd./

---

<div class="post-metadata">

**Author:** ![CDR](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@CDR](https://discuss.elastic.co/u/CDR)\
**Post date:** [August 4, 2017, 4:52pm UTC](https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913/2 "2017-08-04T16:52:28Z")

</div>

`/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/first.conf &`

Or am I misunderstanding your question? Try adding the &

---

<div class="post-metadata">

**Author:** ![shroh](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@shroh](https://discuss.elastic.co/u/shroh)\
**Post date:** [August 4, 2017, 4:57pm UTC](https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913/3 "2017-08-04T16:57:12Z")

</div>

This is fine as long as i am loading first.conf file, but in the real scenario the input would be a beat plugin listening on port 5044, for that logstash service should be continuously running.

How do i make logstash running continously and loads multiple config files that i have in /etc/logstash/conf.d

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 5, 2017, 3:35pm UTC](https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913/4 "2017-08-05T15:35:58Z")

</div>

> I think i am having difficulty on starting logstash as a service which runs continuously in the background to read all the config files under the directory /etc/logstash/conf.d/

> **[Running Logstash as a Service on Debian or RPM | Logstash Reference \[8.11\] |...](https://www.elastic.co/guide/en/logstash/current/running-logstash.html)**

---

<div class="post-metadata">

**Author:** ![shroh](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@shroh](https://discuss.elastic.co/u/shroh)\
**Post date:** [August 7, 2017, 2:31pm UTC](https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913/5 "2017-08-07T14:31:36Z")

</div>

Thanks Magnus, i did that but right after 4 seconds the process exits and it tries to restart

logstash.service - logstash  
Loaded: loaded (/etc/systemd/system/logstash.service; enabled; vendor preset: disabled)  
Active: activating (auto-restart) (Result: exit-code) since Mon 2017-08-07 14:30:21 UTC; 18ms ago  
Process: 28825 ExecStart=/usr/share/logstash/bin/logstash --path.settings /etc/logstash (code=exited, status=1/FAILURE)  
Main PID: 28825 (code=exited, status=1/FAILURE)

Aug 07 14:30:21 [ip-10-xx.xx.xx.domain.com](http://ip-10-xx.xx.xx.domain.com) systemd[1]: logstash.service: main process exited, code=exited, status=1/FAILURE  
Aug 07 14:30:21ip-10-xx.xx.xx.domain.com systemd[1]: Unit logstash.service entered failed state.  
Aug 07 14:30:21 [ip-10-xx.xx.xx.domain.com](http://ip-10-xx.xx.xx.domain.com) systemd[1]: logstash.service failed.

---

<div class="post-metadata">

**Author:** ![shroh](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@shroh](https://discuss.elastic.co/u/shroh)\
**Post date:** [August 7, 2017, 6:10pm UTC](https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913/6 "2017-08-07T18:10:47Z")

</div>

When i run logstash like this

/usr/share/logstash/bin/logstash --path.settings /etc/logstash/conf.d -f /etc/logstash/conf.d/app.conf & it works forever, but not when i run this systemctl start logstash

No errors logged in /var/log/logstash.log

---

<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 4, 2017, 6:11pm UTC](https://discuss.elastic.co/t/running-logstash-in-the-background-in-production-environment/95913/7 "2017-09-04T18:11:01Z")

</div>

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