# As of 7.x log4j2 no longer supports "IfLastModified"

**URL:** <https://discuss.elastic.co/t/as-of-7-x-log4j2-no-longer-supports-iflastmodified/258918>\
**Category:** Elasticsearch\
**Created:** [December 16, 2020, 10:01pm UTC](https://discuss.elastic.co/t/as-of-7-x-log4j2-no-longer-supports-iflastmodified/258918 "2020-12-16T22:01:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Bates](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_bates/32/81005_2.png) [@Eric\_Bates](https://discuss.elastic.co/u/Eric_Bates)\
**Post date:** [December 16, 2020, 10:01pm UTC](https://discuss.elastic.co/t/as-of-7-x-log4j2-no-longer-supports-iflastmodified/258918/1 "2020-12-16T22:01:39Z")

</div>

There is an example given on [Logging](https://www.elastic.co/guide/en/elasticsearch/reference/current/logging.html) to rotate logs every 7 days instead of waiting for 2G of logs to accumulate. This example worked well for ELK 6.x, but as of upgrading to 7.x, it now produces the error:

`Dec 16 16:42:53 netflow systemd-entrypoint[13214]: 2020-12-16 16:42:53,107 main ERROR Null object returned for IfLastModified in IfFileName.`

To repeat:

```auto
    # git diff elasticsearch/log4j2.properties
    diff --git a/elasticsearch/log4j2.properties b/elasticsearch/log4j2.properties
    index a6c39e7..69ee15b 100644
    --- a/elasticsearch/log4j2.properties
    +++ b/elasticsearch/log4j2.properties
    @@ -25,8 +32,10 @@ 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.cluster_name}-*
    -appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
    -appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB
    +#appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
    +#appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB
    +appender.rolling.strategy.action.condition.nested_condition.type = IfLastModified
    +appender.rolling.strategy.action.condition.nested_condition.exceeds = 7D
     ################################################
     ######## Server - old style pattern ###########
     appender.rolling_old.type = RollingFile

```

Is there an alternative?  
Can the documentation be updated?

---

<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:** [January 13, 2021, 10:01pm UTC](https://discuss.elastic.co/t/as-of-7-x-log4j2-no-longer-supports-iflastmodified/258918/2 "2021-01-13T22:01:46Z")

</div>

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