"old" log files.log max number retained

Hello!
My problem is about setting properly a max number of retained files (*.log).
Here the beginning my log4j.j2:

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.}] [%node_name]%marker %m%n

######## Server JSON ############################
#Configure the RollingFile appender
appender.rolling.type = RollingFile
appender.rolling.name = rolling
#Log to /var/log/elasticsearch/production_server.json
appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_server.json
#Use JSON layout. 
appender.rolling.layout.type = ESJsonLayout
#type_name is a flag populating the type field in a ESJsonLayout. It can be used to distinguish different types of logs more easily when parsing them.
appender.rolling.layout.type_name = server

#Roll logs to /var/log/elasticsearch/production-yyyy-MM-dd-i.json; logs will be compressed on each roll and i will be incremented
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.json.gz
#rolling.policies determines the desired threshold to roll logs
appender.rolling.policies.type = Policies
#Use a time-based roll policy
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
#Roll logs on a daily basis because we set the smallest time unit in filePattern to day (%d{yyyy-MM-dd} d for days being the smallest time unit)
appender.rolling.policies.time.interval = 1
#Align rolls on the day boundary (as opposed to rolling every twenty-four hours)
appender.rolling.policies.time.modulate = true
#Using a size-based roll policy
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
#Roll logs if their size is above 128 MB
appender.rolling.policies.size.size = 64000KB

appender.rolling.strategy.type = DefaultRolloverStrategy
#appender.rolling.strategy.max = 10
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 = IfAny
appender.rolling.strategy.action.condition.nested_condition.fileSize.type = IfAccumulatedFileSize
appender.rolling.strategy.action.condition.nested_condition.fileSize.exceeds = 8GB
appender.rolling.strategy.action.condition.nested_condition.lastMod.type = IfLastModified
appender.rolling.strategy.action.condition.nested_condition.lastMod.age = 30D 

################################################
######## Server -  old style pattern ###########
appender.rolling_old.type = RollingFile
appender.rolling_old.name = rolling_old
appender.rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log
appender.rolling_old.layout.type = PatternLayout
appender.rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n

appender.rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling_old.policies.type = Policies
appender.rolling_old.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling_old.policies.time.interval = 1
appender.rolling_old.policies.time.modulate = true
appender.rolling_old.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling_old.policies.size.size = 10KB

appender.rolling_old.strategy.type = DefaultRolloverStrategy
appender.rolling_old.strategy.max = 10
#appender.rolling_old.strategy.fileIndex = nomax
appender.rolling_old.strategy.action.type = Delete
appender.rolling_old.strategy.action.glob = ${sys:es.logs.base_path}
appender.rolling_old.strategy.action.condition.type = IfFileName
appender.rolling_old.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-*
appender.rolling_old.strategy.action.condition.nested_condition.type = IfAny
appender.rolling_old.strategy.action.condition.nested_condition.fileSize.type = IfAccumulatedFileSize
appender.rolling_old.strategy.action.condition.nested_condition.fileSize.exceeds = 8GB
appender.rolling_old.strategy.action.condition.nested_condition.lastMod.type = IfLastModified
appender.rolling_old.strategy.action.condition.nested_condition.lastMod.age = 30D 

Everything works fine for json logs, how ever .log files seem limited to 7 files a day, whether i use "appender.rolling_old.strategy.fileIndex = nomax" or "appender.rolling_old.strategy.max = 10" options.
EDIT: It appears that it's actually limited by unit of "time.interval", for example if i set time.interval to 30 seconds, i can store up to 7 .logs files per 30 seconds.
Is it a wanted behavior or would it be another way to set a maximum number of .log files per unit of time.interval?

Do not hesitate to ask me more information if i'm not clear.
Thank you for your time!

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