# Elasticsearch Log deletion not happening as per defined days in log4j.pproperties file

**URL:** <https://discuss.elastic.co/t/elasticsearch-log-deletion-not-happening-as-per-defined-days-in-log4j-pproperties-file/296934>\
**Category:** Elasticsearch\
**Created:** [February 11, 2022, 5:21am UTC](https://discuss.elastic.co/t/elasticsearch-log-deletion-not-happening-as-per-defined-days-in-log4j-pproperties-file/296934 "2022-02-11T05:21:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pratikshatiwari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pratikshatiwari/32/116646_2.png) [@pratikshatiwari](https://discuss.elastic.co/u/pratikshatiwari)\
**Post date:** [February 11, 2022, 5:21am UTC](https://discuss.elastic.co/t/elasticsearch-log-deletion-not-happening-as-per-defined-days-in-log4j-pproperties-file/296934/1 "2022-02-11T05:21:29Z")

</div>

Dear Team,

We are facing an issue where Elasticsearch logging with log4j2.properties not performing the log rotation on the basis of lfLastmodified age condition, we want to rotate the logs every after 7days but it is not working.

It would be great to get help on this issue, is there anything we can correct to make it working.

Elasticsearch version 7.14.1

Following are the configuration details from log4j2.properties.

############json logs#########################  
appender.rolling.strategy.action.ifAny.type = IfAny  
appender.rolling.strategy.action.ifAny.ifLastModified.type = IfLastModified  
appender.rolling.strategy.action.ifAny.ifLastModified.age = 7D  
appender.rolling.strategy.action.ifAny.ifAccumulatedFileSize.type = IfAccumulatedFileSize  
appender.rolling.strategy.action.ifAny.ifAccumulatedFileSize.exceeds = 2GB

######## Server - old style pattern ###########  
appender.rolling\_old.strategy.action.ifAny.type = IfAny  
appender.rolling\_old.strategy.action.ifAny.ifLastModified.type = IfLastModified  
appender.rolling\_old.strategy.action.ifAny.ifLastModified.age = 7D  
appender.rolling\_old.strategy.action.ifAny.ifAccumulatedFileSize.type = IfAccumulatedFileSize  
appender.rolling\_old.strategy.action.ifAny.ifAccumulatedFileSize.exceeds = 2GB

##############################################

Thank you in advance

Regards  
Pratiksha

---

<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 11, 2022, 5:22am UTC](https://discuss.elastic.co/t/elasticsearch-log-deletion-not-happening-as-per-defined-days-in-log4j-pproperties-file/296934/2 "2022-03-11T05:22:17Z")

</div>

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