Elasticseach v5.x - Configuration rolling log files with log4j2


(Jiri Petak) #1

Hi, i am trying to configure log4j2.properties file for setting up rolling log files.
Using configuration from official elastic pages:

status = error

# log action execution errors for easier debugging
logger.action.name = org.elasticsearch.action
logger.action.level = debug

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n

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] %.10000m%n
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}.log
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.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}-*

rootLogger.level = info
rootLogger.appenderRef.console.ref = console
rootLogger.appenderRef.rolling.ref = rolling

Logs are not rolled by days:
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Aug 27 02:01 elastic-stack-dev-2017-08-27.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Aug 28 02:01 elastic-stack-dev-2017-08-28.log
-rw-r--r-- 1 elasticsearch elasticsearch 4213 Aug 29 12:31 elastic-stack-dev-2017-08-29.log
-rw-r--r-- 1 elasticsearch elasticsearch 4257 Aug 30 03:03 elastic-stack-dev-2017-08-30.log
-rw-r--r-- 1 elasticsearch elasticsearch 3923 Aug 31 02:04 elastic-stack-dev-2017-08-31.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Sep 1 03:05 elastic-stack-dev-2017-09-01.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Sep 2 03:06 elastic-stack-dev-2017-09-02.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Sep 3 02:06 elastic-stack-dev-2017-09-03.log
-rw-r--r-- 1 elasticsearch elasticsearch 3542 Sep 4 02:07 elastic-stack-dev-2017-09-04.log
-rw-r--r-- 1 elasticsearch elasticsearch 4019 Sep 5 17:23 elastic-stack-dev-2017-09-05.log
-rw-r--r-- 1 elasticsearch elasticsearch 3735 Sep 6 02:09 elastic-stack-dev-2017-09-06.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Sep 7 02:09 elastic-stack-dev-2017-09-07.log
-rw-r--r-- 1 elasticsearch elasticsearch 6431 Sep 8 18:07 elastic-stack-dev-2017-09-08.log
-rw-r--r-- 1 elasticsearch elasticsearch 4839 Sep 9 03:11 elastic-stack-dev-2017-09-09.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Sep 10 02:02 elastic-stack-dev-2017-09-10.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Sep 11 02:13 elastic-stack-dev-2017-09-11.log
-rw-r--r-- 1 elasticsearch elasticsearch 3733 Sep 12 04:14 elastic-stack-dev-2017-09-12.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Sep 13 03:14 elastic-stack-dev-2017-09-13.log
-rw-r--r-- 1 elasticsearch elasticsearch 4115 Sep 14 02:15 elastic-stack-dev-2017-09-14.log
-rw-r--r-- 1 elasticsearch elasticsearch 4406 Sep 15 10:08 elastic-stack-dev-2017-09-15.log
-rw-r--r-- 1 elasticsearch elasticsearch 4257 Sep 16 04:17 elastic-stack-dev-2017-09-16.log
-rw-r--r-- 1 elasticsearch elasticsearch 9716 Sep 17 02:17 elastic-stack-dev-2017-09-17.log
-rw-r--r-- 1 elasticsearch elasticsearch 4406 Sep 18 09:05 elastic-stack-dev-2017-09-18.log
-rw-r--r-- 1 elasticsearch elasticsearch 4652 Sep 19 15:06 elastic-stack-dev-2017-09-19.log
-rw-r--r-- 1 elasticsearch elasticsearch 4127 Sep 20 02:40 elastic-stack-dev-2017-09-20.log
-rw-r--r-- 1 elasticsearch elasticsearch 4269 Sep 21 03:24 elastic-stack-dev-2017-09-21.log
-rw-r--r-- 1 elasticsearch elasticsearch 4269 Sep 22 03:18 elastic-stack-dev-2017-09-22.log
-rw-r--r-- 1 elasticsearch elasticsearch 4127 Sep 23 03:49 elastic-stack-dev-2017-09-23.log
-rw-r--r-- 1 elasticsearch elasticsearch 4077 Sep 24 02:50 elastic-stack-dev-2017-09-24.log
-rw-r--r-- 1 elasticsearch elasticsearch 4272 Sep 25 03:51 elastic-stack-dev-2017-09-25.log
-rw-r--r-- 1 elasticsearch elasticsearch 4131 Sep 26 02:56 elastic-stack-dev-2017-09-26.log
-rw-r--r-- 1 elasticsearch elasticsearch 28422 Sep 27 15:17 elastic-stack-dev-2017-09-27.log
-rw-r--r-- 1 elasticsearch elasticsearch 11190 Oct 2 16:13 elastic-stack-dev_deprecation.log
-rw-r--r-- 1 elasticsearch elasticsearch 0 Mar 28 2017 elastic-stack-dev_index_indexing_slowlog.log
-rw-r--r-- 1 elasticsearch elasticsearch 0 Mar 28 2017 elastic-stack-dev_index_search_slowlog.log
-rw-r--r-- 1 elasticsearch elasticsearch 131144 Oct 2 16:13 elastic-stack-dev.log

And retention (deletion) after 7 days not working too.

Could someone help with that

Thank you


(system) #2

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