Log rotation for cluster log file configure in log4j2 properties

We are using the ES 7.4.2
Our log4j2.properties has the following configuration

Even policy appender.rolling.policies.time.interval = 1 set to 1 day, still log file is not rotated.
As soon as re restart the elasticsearch service the log file is rotated
-rw-r--r-- 1 elasticsearch elasticsearch 10152 Apr 28 17:23 es-cluster-loadtest-2020-04-27-1.log.gz
-rw-r--r-- 1 elasticsearch elasticsearch 11153 Apr 28 17:24 es-cluster-loadtest.log

Please help me so that elasticsearch log rotated daily at beginning of each day. Our servers configure UTC time, we need to get this change at midnight UTC time. Also we do not have to restart the elasticsearch service.

appender.rolling.type = RollingFile
appender.rolling.name = rolling
appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.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

I really appreciate your reply on my this case.

Please verify my setting of log4j2.properties mention above.

As it is set to time base trigger policy set to 1 day.
It is still not rotated today. Please help me configuration so log rotation works.

Your early help will be appreciated.


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