# Add maxFileSize and maxBackupIndex in logging.yml but won't work

**URL:** <https://discuss.elastic.co/t/add-maxfilesize-and-maxbackupindex-in-logging-yml-but-wont-work/43333>\
**Category:** Elasticsearch\
**Created:** [March 3, 2016, 3:52am UTC](https://discuss.elastic.co/t/add-maxfilesize-and-maxbackupindex-in-logging-yml-but-wont-work/43333 "2016-03-03T03:52:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![makeyang](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@makeyang](https://discuss.elastic.co/u/makeyang)\
**Post date:** [March 3, 2016, 3:52am UTC](https://discuss.elastic.co/t/add-maxfilesize-and-maxbackupindex-in-logging-yml-but-wont-work/43333/1 "2016-03-03T03:52:57Z")

</div>

my logging.yml looks like below:  
file:  
type: dailyRollingFile  
file: ${path.logs}/${[cluster.name](http://cluster.name)}.log  
datePattern: "'.'yyyy-MM-dd"  
maxFileSize: 1GB  
maxBackupIndex: 15  
layout:  
type: pattern  
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

so how to achieve so?

---

<div class="post-metadata">

**Author:** ![jimczi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimczi/32/47985_2.png) [@jimczi](https://discuss.elastic.co/u/jimczi)\
**Post date:** [March 3, 2016, 9:54am UTC](https://discuss.elastic.co/t/add-maxfilesize-and-maxbackupindex-in-logging-yml-but-wont-work/43333/2 "2016-03-03T09:54:52Z")

</div>

The daily rolling file doesn't have a maxBackupIndex configuration, only the rolling file appender has it:  
[https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html](https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html)  
If you want to achieve the same functionality you'll have to write a custom appender.

---

<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:11pm UTC](https://discuss.elastic.co/t/add-maxfilesize-and-maxbackupindex-in-logging-yml-but-wont-work/43333/3 "2017-07-05T23:11:41Z")

</div>


