# How to stop logstash gracefully when using kubernetes

**URL:** <https://discuss.elastic.co/t/how-to-stop-logstash-gracefully-when-using-kubernetes/241288>\
**Category:** Logstash\
**Created:** [July 15, 2020, 12:09pm UTC](https://discuss.elastic.co/t/how-to-stop-logstash-gracefully-when-using-kubernetes/241288 "2020-07-15T12:09:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![benz](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@benz](https://discuss.elastic.co/u/benz)\
**Post date:** [July 15, 2020, 12:09pm UTC](https://discuss.elastic.co/t/how-to-stop-logstash-gracefully-when-using-kubernetes/241288/1 "2020-07-15T12:09:32Z")

</div>

Hi,

We are running logstash as statefulset over k8s. I am looking for a way to stop logstash only after it finish process all in-flight events.  
We already use:

`enable_auto_commit => "false"`

for kafka input so I guess that cover kafka, what can we do as general scenario?

---

<div class="post-metadata">

**Author:** ![grumo35](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grumo35/32/59451_2.png) [@grumo35](https://discuss.elastic.co/u/grumo35)\
**Post date:** [July 15, 2020, 1:54pm UTC](https://discuss.elastic.co/t/how-to-stop-logstash-gracefully-when-using-kubernetes/241288/2 "2020-07-15T13:54:26Z")

</div>

I would imagine a script that monitor logstash activtity ( redirected into a file or something ) to check for newlines ?

I don't really know if there is a built in way to check for logstash activity.

Good luck

---

<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:** [August 12, 2020, 1:54pm UTC](https://discuss.elastic.co/t/how-to-stop-logstash-gracefully-when-using-kubernetes/241288/3 "2020-08-12T13:54:33Z")

</div>

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