# Pruning logs - how to get maxBackupIndex to work?

**URL:** <https://discuss.elastic.co/t/pruning-logs-how-to-get-maxbackupindex-to-work/21301>\
**Category:** Elasticsearch\
**Created:** [December 17, 2014, 8:00pm UTC](https://discuss.elastic.co/t/pruning-logs-how-to-get-maxbackupindex-to-work/21301 "2014-12-17T20:00:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pauline\_Kelly](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@Pauline\_Kelly](https://discuss.elastic.co/u/Pauline_Kelly)\
**Post date:** [December 17, 2014, 8:00pm UTC](https://discuss.elastic.co/t/pruning-logs-how-to-get-maxbackupindex-to-work/21301/1 "2014-12-17T20:00:05Z")

</div>

Elasticsearch isn't pruning the logs, so I found this input to add to  
logging.yml.  
However, this isn't working for me.

Is there any other workarounds- configs for this file that will work?

file:  
type: dailyRollingFile  
file: ${path.logs}/${cluster.name}.log  
datePattern: "'.'yyyy-MM-dd"  
#I added the following line in order to delete logs every 7 days  
maxBackupIndex: 7  
layout:  
type: pattern  
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

Cheers

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/84410fb0-2edb-4d2e-b164-dc537061fd61%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/84410fb0-2edb-4d2e-b164-dc537061fd61%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [December 17, 2014, 8:06pm UTC](https://discuss.elastic.co/t/pruning-logs-how-to-get-maxbackupindex-to-work/21301/2 "2014-12-17T20:06:59Z")

</div>

Something like this should work. The dailyRollingFile appender does not  
support maxBackupIndex.

appender:  
.....  
file:  
type: rollingFile  
file: ${path.logs}/${cluster.name}.log  
maxFileSize: 10000000  
maxBackupIndex: 10  
layout:  
type: pattern  
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

See also  
[http://elasticsearch-users.115913.n3.nabble.com/log-file-rolling-by-size-td4025190.html](http://elasticsearch-users.115913.n3.nabble.com/log-file-rolling-by-size-td4025190.html)

Jörg

On Wed, Dec 17, 2014 at 9:00 PM, Pauline Kelly [pauline.m.kelly1@gmail.com](mailto:pauline.m.kelly1@gmail.com)  
wrote:

> Elasticsearch isn't pruning the logs, so I found this input to add to  
> logging.yml.  
> However, this isn't working for me.
> 
> Is there any other workarounds- configs for this file that will work?
> 
> file:  
> type: dailyRollingFile  
> file: ${path.logs}/${cluster.name}.log  
> datePattern: "'.'yyyy-MM-dd"  
> #I added the following line in order to delete logs every 7 days  
> maxBackupIndex: 7  
> layout:  
> type: pattern  
> conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
> 
> Cheers
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/84410fb0-2edb-4d2e-b164-dc537061fd61%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/84410fb0-2edb-4d2e-b164-dc537061fd61%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/84410fb0-2edb-4d2e-b164-dc537061fd61%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/84410fb0-2edb-4d2e-b164-dc537061fd61%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFQ3jMZBgEyjXXxyV8QvN%3Dpe%2BpYDQSpuoLOdp0Gn\_E6nA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFQ3jMZBgEyjXXxyV8QvN%3Dpe%2BpYDQSpuoLOdp0Gn_E6nA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:43am UTC](https://discuss.elastic.co/t/pruning-logs-how-to-get-maxbackupindex-to-work/21301/3 "2017-07-06T00:43:07Z")

</div>


