# Restrict the number of log files

**URL:** https://discuss.elastic.co/t/restrict-the-number-of-log-files/25416
**Category:** Elasticsearch
**Created:** [July 13, 2015, 8:06am UTC](https://discuss.elastic.co/t/restrict-the-number-of-log-files/25416 "2015-07-13T08:06:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![achimweigel](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@achimweigel](https://discuss.elastic.co/u/achimweigel)
#### Post date: [July 13, 2015, 8:06am UTC](https://discuss.elastic.co/t/restrict-the-number-of-log-files/25416/1 "2015-07-13T08:06:40Z")

</div>

Hello,

we are using Elasticsearch 1.6 and have configured in the logging.yml a logger which compresses a log file when it achieves a maximal size of 100KB:

file:  
type: extrasRollingFile  
file: ${path.logs}/${cluster.name}.log  
rollingPolicy: timeBased  
rollingPolicy.FileNamePattern: ${path.logs}/${cluster.name}\_%i.log.%d{yyyy-MM-dd}.gz  
triggeringPolicy.MaxFileSize: 100KB  
layout:  
type: pattern  
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

Is it also possible to add some configuration such that old compressed log files are removed e.g. after 14 days? We tried the parameter MaxBackupIndex but it was not accepted by Elasticsearch - perhaps we just do not know the syntax how to add it.

Thank you very much and best Regards.  
Achim

---

<div class="post-metadata">

### Author: ![Mrc0113](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@Mrc0113](https://discuss.elastic.co/u/Mrc0113)
#### Post date: [August 24, 2015, 3:13pm UTC](https://discuss.elastic.co/t/restrict-the-number-of-log-files/25416/2 "2015-08-24T15:13:58Z")

</div>

@achimweigel - Did you figure this out or did you have to use a different or custom appender?

---

<div class="post-metadata">

### Author: ![achimweigel](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@achimweigel](https://discuss.elastic.co/u/achimweigel)
#### Post date: [August 25, 2015, 11:20am UTC](https://discuss.elastic.co/t/restrict-the-number-of-log-files/25416/3 "2015-08-25T11:20:41Z")

</div>

Unfortunately not. We decided to configure the logging by adapting the logging.yml file, i.e. we restricted the size and max number of the different log files. Furthermore we commented out the following log files in the ES config.yml:

index.indexing.slowlog.threshold.index.warn: 10s  
index.indexing.slowlog.threshold.index.info: 5s  
index.indexing.slowlog.threshold.index.debug: 2s  
index.indexing.slowlog.threshold.index.trace: 500ms

---

<div class="post-metadata">

### Author: ![Mrc0113](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@Mrc0113](https://discuss.elastic.co/u/Mrc0113)
#### Post date: [August 26, 2015, 1:36pm UTC](https://discuss.elastic.co/t/restrict-the-number-of-log-files/25416/4 "2015-08-26T13:36:03Z")

</div>

Thanks for the info - we'll likely end up doing the same

---

<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 5, 2017, 11:53pm UTC](https://discuss.elastic.co/t/restrict-the-number-of-log-files/25416/5 "2017-07-05T23:53:46Z")

</div>


