Log4j2.properties configuration for elasticsearch

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

I have configured the policy as follows:

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

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