# Stop Logstash when it has finished to read a csv file

**URL:** <https://discuss.elastic.co/t/stop-logstash-when-it-has-finished-to-read-a-csv-file/26632>\
**Category:** Logstash\
**Created:** [July 31, 2015, 9:55am UTC](https://discuss.elastic.co/t/stop-logstash-when-it-has-finished-to-read-a-csv-file/26632 "2015-07-31T09:55:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrian0limit](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@Adrian0limit](https://discuss.elastic.co/u/Adrian0limit)\
**Post date:** [July 31, 2015, 9:55am UTC](https://discuss.elastic.co/t/stop-logstash-when-it-has-finished-to-read-a-csv-file/26632/1 "2015-07-31T09:55:00Z")

</div>

Hi everybody,

I'm using Logstash 1.5.3 and its input "file" in order to index a csv file to Elasticsearch. I want to execute logstash and when it has finished to read my file I want to properly stop Logstash. How can I do that?

Thanks in advance for your help.

---

<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:** [July 31, 2015, 5:51pm UTC](https://discuss.elastic.co/t/stop-logstash-when-it-has-finished-to-read-a-csv-file/26632/2 "2015-07-31T17:51:07Z")

</div>

Logstash's file input has no concept of "done" so it can't shut down Logstash when it's done. The StackOverflow answer below lists a couple of options.

> <https://stackoverflow.com/questions/30759951/delete-logs-after-consumption-logstash/30772614#30772614>

---

<div class="post-metadata">

**Author:** ![Adrian0limit](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@Adrian0limit](https://discuss.elastic.co/u/Adrian0limit)\
**Post date:** [August 3, 2015, 12:34pm UTC](https://discuss.elastic.co/t/stop-logstash-when-it-has-finished-to-read-a-csv-file/26632/3 "2015-08-03T12:34:20Z")

</div>

Thank you for your answer, I have already read this post and I wanted to know if it was possible to properly stop Logstash when it had finished to read one csv file.

I think it would be a great idea to offer this option in a future release, it would be an option as "process\_once" =\> true or false.

---

<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:33am UTC](https://discuss.elastic.co/t/stop-logstash-when-it-has-finished-to-read-a-csv-file/26632/4 "2017-07-06T05:33:04Z")

</div>


