# Elasticsearch log rotatio not working using log4j2.properties

**URL:** <https://discuss.elastic.co/t/elasticsearch-log-rotatio-not-working-using-log4j2-properties/217824>\
**Category:** Elasticsearch\
**Created:** [February 4, 2020, 1:52pm UTC](https://discuss.elastic.co/t/elasticsearch-log-rotatio-not-working-using-log4j2-properties/217824 "2020-02-04T13:52:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![saumilmac](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@saumilmac](https://discuss.elastic.co/u/saumilmac)\
**Post date:** [February 4, 2020, 1:52pm UTC](https://discuss.elastic.co/t/elasticsearch-log-rotatio-not-working-using-log4j2-properties/217824/1 "2020-02-04T13:52:34Z")

</div>

**I am trying to rotate my elasticsearch logs using log4j2. However, using the below configuration I am not able to do so. Any help would be appreciated.**

status = error

# log action execution errors for easier debugging

logger.action.name = org.elasticsearch.action  
logger.action.level = debug

appender.console.type = Console  
appender.console.name = console  
appender.console.layout.type = PatternLayout  
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n

appender.rolling.type = RollingFile  
appender.rolling.name = rolling  
appender.rolling.fileName = {sys:es.logs.base\_path}{sys:file.separator}{sys:es.logs.cluster\_name}.log appender.rolling.layout.type = PatternLayout appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n appender.rolling.filePattern = {sys:es.logs.base\_path}{sys:file.separator}{sys:es.logs.cluster\_name}-%d{yyyy-MM-dd}-%i.log.gz  
appender.rolling.policies.type = Policies  
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy  
appender.rolling.policies.time.interval = 1  
appender.rolling.policies.time.modulate = true  
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy  
appender.rolling.policies.size.size = 128MB  
appender.rolling.strategy.type = DefaultRolloverStrategy  
appender.rolling.strategy.fileIndex = nomax  
appender.rolling.strategy.action.type = Delete  
appender.rolling.strategy.action.basepath = {sys:es.logs.base\_path} appender.rolling.strategy.action.condition.type = IfFileName appender.rolling.strategy.action.condition.glob = {sys:es.logs.base\_path}{sys:file.separator}{sys:es.logs.cluster\_name}-%d{yyyy-MM-dd}-%i.log.gz  
appender.rolling.strategy.action.condition.nested\_condition.type = IfLastModified  
appender.rolling.strategy.action.condition.nested\_condition.age = 3D  
#appender.rolling.strategy.action.condition.nested\_condition.type = IfAccumulatedFileSize  
#appender.rolling.strategy.action.condition.nested\_condition.exceeds = 2GB

---

<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:** [March 3, 2020, 1:52pm UTC](https://discuss.elastic.co/t/elasticsearch-log-rotatio-not-working-using-log4j2-properties/217824/2 "2020-03-03T13:52:36Z")

</div>

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