# Logrotate delete old files

**URL:** <https://discuss.elastic.co/t/logrotate-delete-old-files/227279>\
**Category:** Elasticsearch\
**Created:** [April 9, 2020, 8:43am UTC](https://discuss.elastic.co/t/logrotate-delete-old-files/227279 "2020-04-09T08:43:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![asp](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@asp](https://discuss.elastic.co/u/asp)\
**Post date:** [April 9, 2020, 8:43am UTC](https://discuss.elastic.co/t/logrotate-delete-old-files/227279/1 "2020-04-09T08:43:57Z")

</div>

Hi,

I am using elasticsearch 7.5.2. Elasticsearch is rotating its logs each day by default.  
How can I configure elasticsearch to keep only the last 7 days for example?

What is best practice? If possible I don't want to configure it again after each elasticsearch update.  
If possible want to use elasticsearch internal tools, rather than running external scripts by cron.

Regards, Andreas  
Thanks , Andreas

---

<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 7, 2020, 8:44am UTC](https://discuss.elastic.co/t/logrotate-delete-old-files/227279/2 "2020-05-07T08:44:00Z")

</div>

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