I am trying to limit the number of logs that are kept on my cloudstack management server. I am running log4j 1.2 and have recently added "<param name="MaxBackupIndex" value="31"/>
" to my config (/etc/cloudstack/management/log4j-cloud.xml) to only keep 31 logs:
<appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="Append" value="true"/>
<param name="Threshold" value="TRACE"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="/var/log/cloudstack/management/management-server.log.%d{yyyy-MM-dd}.gz"/>
<param name="ActiveFileName" value="/var/log/cloudstack/management/management-server.log"/>
<param name="MaxBackupIndex" value="31"/>
</rollingPolicy>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1.}] (%t:%x) (logid:%X{logcontextid}) %m%n"/>
</layout>
</appender>
However all the logs are still there and I have run out of ideas. Does log4j not apply its archival policy to older logs? Is there anything else I need to change? Any suggestions would be appreciated.