# How to tail\_files once in filebeat

**URL:** <https://discuss.elastic.co/t/how-to-tail-files-once-in-filebeat/212007>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [December 16, 2019, 12:50pm UTC](https://discuss.elastic.co/t/how-to-tail-files-once-in-filebeat/212007 "2019-12-16T12:50:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chenyahui](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@chenyahui](https://discuss.elastic.co/u/chenyahui)\
**Post date:** [December 16, 2019, 12:50pm UTC](https://discuss.elastic.co/t/how-to-tail-files-once-in-filebeat/212007/1 "2019-12-16T12:50:14Z")

</div>

How to invoke tail\_files just once in filebeat? Whether or not the filebeat restart later.

The usage scenario is that I don't want to deal the exist files，and I just want to process new data

But if I only use `tail_files`, it may lost data when the filebeat restart.

Is filebeat support this scenario?

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [December 16, 2019, 1:35pm UTC](https://discuss.elastic.co/t/how-to-tail-files-once-in-filebeat/212007/2 "2019-12-16T13:35:51Z")

</div>

Hey @chenyahui and welcome to discuss 🙂

`filebeat run` can be executed with the `--once` flags, that runs filebeat only until all the files have been read, then it stops, is this what you are looking for?

```auto
  --once Run filebeat only once until all harvesters reach EOF

```

---

<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:** [January 13, 2020, 1:36pm UTC](https://discuss.elastic.co/t/how-to-tail-files-once-in-filebeat/212007/3 "2020-01-13T13:36:05Z")

</div>

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