# File input plugin to process files not newer than X seconds ago

**URL:** <https://discuss.elastic.co/t/file-input-plugin-to-process-files-not-newer-than-x-seconds-ago/377915>\
**Category:** Logstash\
**Created:** [May 7, 2025, 3:14pm UTC](https://discuss.elastic.co/t/file-input-plugin-to-process-files-not-newer-than-x-seconds-ago/377915 "2025-05-07T15:14:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francesco\_Esposito](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francesco_esposito/32/141865_2.png) [@Francesco\_Esposito](https://discuss.elastic.co/u/Francesco_Esposito)\
**Post date:** [May 7, 2025, 3:14pm UTC](https://discuss.elastic.co/t/file-input-plugin-to-process-files-not-newer-than-x-seconds-ago/377915/1 "2025-05-07T15:14:46Z")

</div>

Hello again.

I am trying to use file input plugin, read mode, delete after completion, but I need to take in charge just files that are not newer than X seconds ago.

This because my logger application writes a new file (to be then took in charge by Logstash) each second and I want to avoid to take in charge a file that is going to be written completely. So, I can be sure it can be deleted.

Is there a way to do so?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [May 7, 2025, 3:43pm UTC](https://discuss.elastic.co/t/file-input-plugin-to-process-files-not-newer-than-x-seconds-ago/377915/2 "2025-05-07T15:43:16Z")

</div>

> [@Francesco\_Esposito](#):
>
> Is there a way to do so?

No, you can ignore files that are older than some specific time, but you cannot configure it to ignore files that are newer than some specific time.

The `read` mode should be used with files that are already completed, if you have an application still writing into the file, it may have some issues.

I think you may use `stat_interval` and `discover_interval` to increase the interval in which Logstash checks for new files in the configured path.

The first setting is related to checking if a file has been modified, it makes more sense when using `tail` mode, the second setting is a multiplier for the first one and is related to the interval in which logstash checks for new files.

The default values are `1 second` and `15`, so Logstash checks for new files every 15 seconds.
