# Log4j2 questions

**URL:** <https://discuss.elastic.co/t/log4j2-questions/105276>\
**Category:** Elasticsearch\
**Created:** [October 25, 2017, 4:41pm UTC](https://discuss.elastic.co/t/log4j2-questions/105276 "2017-10-25T16:41:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_S\_Ryder](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@Michael\_S\_Ryder](https://discuss.elastic.co/u/Michael_S_Ryder)\
**Post date:** [October 25, 2017, 4:41pm UTC](https://discuss.elastic.co/t/log4j2-questions/105276/1 "2017-10-25T16:41:36Z")

</div>

Hello folks

I'd like to update the /etc/elasticsearch/log4j2.properties to automatically prune log files.

I followed some advice I read about here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#logging](https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#logging)

I added the following stanza to log4j2.properties, expecting existing "old" log files to be purged.

```
appender.rolling.strategy.type = DefaultRolloverStrategy 
appender.rolling.strategy.action.type = Delete 
appender.rolling.strategy.action.basepath = ${sys:es.logs.base_path} 
appender.rolling.strategy.action.condition.type = IfLastModified 
appender.rolling.strategy.action.condition.age = 7D 
appender.rolling.strategy.action.PathConditions.type = IfFileName 
appender.rolling.strategy.action.PathConditions.glob = ${sys:es.logs.cluster_name}-*

```

Unfortunately... nothing happened in the past 18 hours. I have months of log files lingering. Am I doing something wrong?

**Questions:**

1. Should this stanza have resulted in purging all but the last 7 days of cluster logs?
2. Do I need to restart Elasticsearch or some other service?

---

<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:** [November 22, 2017, 4:41pm UTC](https://discuss.elastic.co/t/log4j2-questions/105276/2 "2017-11-22T16:41:52Z")

</div>

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