# Deletion of old output files

**URL:** <https://discuss.elastic.co/t/deletion-of-old-output-files/295622>\
**Category:** Logstash\
**Created:** [January 27, 2022, 6:45pm UTC](https://discuss.elastic.co/t/deletion-of-old-output-files/295622 "2022-01-27T18:45:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smzd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smzd/32/100274_2.png) [@smzd](https://discuss.elastic.co/u/smzd)\
**Post date:** [January 27, 2022, 6:45pm UTC](https://discuss.elastic.co/t/deletion-of-old-output-files/295622/1 "2022-01-27T18:45:15Z")

</div>

Hello,  
my logstash is outputing logs in files to then be ingested by elastic agent.  
In order to not have huge amount of disk being consumed by logs, I would like to rotate logs and then delete the old ones (after 3 day).

I can used this for the daily rotation:  
path =\> "./test-%{+YYYY-MM-dd}.txt

but how can I delete the old ones?  
thank you

---

<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:** [February 24, 2022, 6:45pm UTC](https://discuss.elastic.co/t/deletion-of-old-output-files/295622/2 "2022-02-24T18:45:41Z")

</div>

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