# Deleting files after logstash processes them

**URL:** https://discuss.elastic.co/t/deleting-files-after-logstash-processes-them/139133
**Category:** Logstash
**Created:** [July 9, 2018, 10:10am UTC](https://discuss.elastic.co/t/deleting-files-after-logstash-processes-them/139133 "2018-07-09T10:10:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![4b3l](https://avatars.discourse-cdn.com/v4/letter/4/9de0a6/32.png) [@4b3l](https://discuss.elastic.co/u/4b3l)
#### Post date: [July 9, 2018, 10:10am UTC](https://discuss.elastic.co/t/deleting-files-after-logstash-processes-them/139133/1 "2018-07-09T10:10:24Z")

</div>

Hi,

I would like to know if there is a way of deleting log files once logstash has finished processing.

We have files sent to an input folder, logstash then processes them. I would like to clear them down once it is done (as we no longer need the files anymore). Reading through posts, logstash doesn't provide anything out of box (would be a nice enhancement 🙂 ).

How does everyone deal with this? Is it just a case of dumping the files to the input directory and then wait 24hours before removing?

This is on a Centos 7 environment, so not sure if there is a linux command to monitor the file itself?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [July 9, 2018, 10:16am UTC](https://discuss.elastic.co/t/deleting-files-after-logstash-processes-them/139133/2 "2018-07-09T10:16:06Z")

</div>

The [latest version of the file input plugin](https://www.elastic.co/guide/en/logstash-versioned-plugins/current/v4.1.3-plugins-inputs-file.html#v4.1.3-plugins-inputs-file) has a `read` mode that I think support what you are looking for though the [file\_completed\_action](https://www.elastic.co/guide/en/logstash-versioned-plugins/current/v4.1.3-plugins-inputs-file.html#v4.1.3-plugins-inputs-file-file_completed_action) parameter. You may need to explicitly upgrade the plugin to get this version.

---

<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 6, 2018, 10:16am UTC](https://discuss.elastic.co/t/deleting-files-after-logstash-processes-them/139133/3 "2018-08-06T10:16:12Z")

</div>

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