Thank you, @AquaX.
The default max configuration was by default set to 30 in log4j2.properties but I can see around 50 logs in our logs path as the time based roll over approach is preceding over size based approach ( log file size not reaching 100MB before 1 day finishes).
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.strategy.max = 30
I have reduced values for size for testing and seems like max file number works for size based roll over. Below are the configurations:
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 5KB
appender.rolling.strategy.max = 2
Can you please suggest on how
appender.rolling.strategy.max value can be used for TimeBasedTriggeringPolicy as well.
If that's not a possible case, is there any other way to configure the deletion of old logs for time based roll over approach.