# How to start filebeat so that it stops after reading a file

**URL:** <https://discuss.elastic.co/t/how-to-start-filebeat-so-that-it-stops-after-reading-a-file/128110>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [April 16, 2018, 6:59am UTC](https://discuss.elastic.co/t/how-to-start-filebeat-so-that-it-stops-after-reading-a-file/128110 "2018-04-16T06:59:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![terminaattori](https://avatars.discourse-cdn.com/v4/letter/t/e19b73/32.png) [@terminaattori](https://discuss.elastic.co/u/terminaattori)\
**Post date:** [April 16, 2018, 6:59am UTC](https://discuss.elastic.co/t/how-to-start-filebeat-so-that-it-stops-after-reading-a-file/128110/1 "2018-04-16T06:59:35Z")

</div>

Hey!

I am currently trying to parse my old logfiles to elasticsearch. I have a bash script for this and everything would be running fine without the fact that after I have run a file through filebeat to logstash, the filebeat continues monitoring the file. My start command is :

sudo ./filebeat -e -c filebeat.yml -d "publish"

How do I need to modify the command so that filebeat reads the file and stops?

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [April 16, 2018, 8:47am UTC](https://discuss.elastic.co/t/how-to-start-filebeat-so-that-it-stops-after-reading-a-file/128110/2 "2018-04-16T08:47:10Z")

</div>

Hi @terminaattori,

Have a look to the `--once` command line parameter: [https://www.elastic.co/guide/en/beats/filebeat/current/command-line-options.html](https://www.elastic.co/guide/en/beats/filebeat/current/command-line-options.html), you will need to add `close_eof` setting to your inputs, as explained.

Best regards

---

<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:** [May 14, 2018, 8:47am UTC](https://discuss.elastic.co/t/how-to-start-filebeat-so-that-it-stops-after-reading-a-file/128110/3 "2018-05-14T08:47:23Z")

</div>

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