# Gracefully shutdown logstash

**URL:** <https://discuss.elastic.co/t/gracefully-shutdown-logstash/40132>\
**Category:** Logstash\
**Created:** [January 26, 2016, 3:30pm UTC](https://discuss.elastic.co/t/gracefully-shutdown-logstash/40132 "2016-01-26T15:30:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaharmor](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@shaharmor](https://discuss.elastic.co/u/shaharmor)\
**Post date:** [January 26, 2016, 3:30pm UTC](https://discuss.elastic.co/t/gracefully-shutdown-logstash/40132/1 "2016-01-26T15:30:14Z")

</div>

Hi,

How can i gracefully shutdown Logstash without losing any events that it might still be processing?

Basically what i want is to stop the `input` from processing and then wait until all events that are already under way to finish processing and only then terminate the process.

Is the the flow that happens today when i run `service Logstash stop`? And what about when Logstash receives a SIGTERM signal?

---

<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:** [January 27, 2016, 8:43am UTC](https://discuss.elastic.co/t/gracefully-shutdown-logstash/40132/2 "2016-01-27T08:43:54Z")

</div>

> Is the the flow that happens today when i run `service Logstash stop`?

Yes, as of Logstash 1.5 that's how things work.

> And what about when Logstash receives a SIGTERM signal?

`service logstash stop` sends SIGTERM.

---

<div class="post-metadata">

**Author:** ![shaharmor](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@shaharmor](https://discuss.elastic.co/u/shaharmor)\
**Post date:** [January 27, 2016, 8:45am UTC](https://discuss.elastic.co/t/gracefully-shutdown-logstash/40132/3 "2016-01-27T08:45:11Z")

</div>

Great to hear.

And is there a timeout that if Logstash doesn't finish by that timeout it will kill it? Or it just waits forever?

---

<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:** [January 27, 2016, 8:53am UTC](https://discuss.elastic.co/t/gracefully-shutdown-logstash/40132/4 "2016-01-27T08:53:14Z")

</div>

No such timeout is documented so I'd assume there is none.

[https://www.elastic.co/guide/en/logstash/current/stalled-shutdown.html](https://www.elastic.co/guide/en/logstash/current/stalled-shutdown.html)

---

<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:** [July 6, 2017, 5:14am UTC](https://discuss.elastic.co/t/gracefully-shutdown-logstash/40132/5 "2017-07-06T05:14:09Z")

</div>


