# Log File Retention Settings

**URL:** <https://discuss.elastic.co/t/log-file-retention-settings/33160>\
**Category:** Elasticsearch\
**Created:** [October 28, 2015, 3:13pm UTC](https://discuss.elastic.co/t/log-file-retention-settings/33160 "2015-10-28T15:13:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![zylo47](https://avatars.discourse-cdn.com/v4/letter/z/5fc32e/32.png) [@zylo47](https://discuss.elastic.co/u/zylo47)\
**Post date:** [October 29, 2015, 5:00pm UTC](https://discuss.elastic.co/t/log-file-retention-settings/33160/4 "2015-10-29T17:00:58Z")

</div>

I think I found the answer.

This stack post [http://stackoverflow.com/questions/22865522/log4cplus-dailyrollingfileappender-config-maxbackupindex-not-working](http://stackoverflow.com/questions/22865522/log4cplus-dailyrollingfileappender-config-maxbackupindex-not-working) explains that the maxBackupIndex parameter is only for the current logging period. The default ES settings appear to log one file of unlimited size per logging period. So maxBackupIndex would never take effect.

I believe this setting can be used in conjunction with the maxFileSize parameter to limit how many files get created per logging period. So if I had maxFileSize set to something like 100 MB and maxBackupIndex set to 5, then ES (log4j) would only keep 500 MB of data for that current logging period (day).

This other stack post seems to correlate with my assumption [http://stackoverflow.com/questions/3683364/how-to-configure-log4j-to-only-keep-log-files-for-the-last-seven-days](http://stackoverflow.com/questions/3683364/how-to-configure-log4j-to-only-keep-log-files-for-the-last-seven-days)

Looks like I'm going to have to script it out.

---

_[View the full topic](https://discuss.elastic.co/t/log-file-retention-settings/33160)._
