# Log4j2.properties configuration for elasticsearch

**URL:** https://discuss.elastic.co/t/log4j2-properties-configuration-for-elasticsearch/313443
**Category:** Elasticsearch
**Created:** [September 1, 2022, 12:24pm UTC](https://discuss.elastic.co/t/log4j2-properties-configuration-for-elasticsearch/313443 "2022-09-01T12:24:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![irivas95](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@irivas95](https://discuss.elastic.co/u/irivas95)
#### Post date: [September 1, 2022, 12:24pm UTC](https://discuss.elastic.co/t/log4j2-properties-configuration-for-elasticsearch/313443/1 "2022-09-01T12:24:34Z")

</div>

Hi,  
I am trying to configure a log policy based on the IfAccumulatedFileSize property reducing the default 2GB to 50MB because I already have too many logs in my folder. I have seen that the folder where I have the logs already weighs 50MB.

![image](https://us1.discourse-cdn.com/elastic/original/3X/b/b/bbb7dfc894418ee829b3ffbaf1aaf747dd6bf6e1.png)

I have configured the policy as follows:

```auto
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.json.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.cluster_name}-*
appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
appender.rolling.strategy.action.condition.nested_condition.exceeds = 50MB

```

according to my configuration shouldn't some logs already be being deleted or am I understanding something wrong?

thanks in advance

---

<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: [September 29, 2022, 12:25pm UTC](https://discuss.elastic.co/t/log4j2-properties-configuration-for-elasticsearch/313443/2 "2022-09-29T12:25:22Z")

</div>

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