You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by Richard Lawley <ri...@richardlawley.com> on 2019/09/23 11:02:46 UTC

Log Retention via log4j

I'm having a bit of difficulty getting my logfiles to be cleared up
using the basic logging configuration supplied in Cloudstack.  From
what I can tell, I should be adding the MaxBackupIndex parameter, but
cannot seem to get this to work.

I've tried...

   <appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
      <param name="Append" value="true"/>
      <param name="Threshold" value="TRACE"/>
      <param name="MaxBackupIndex" value="14"/>
      <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"/>
      </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>

I've also tried MaxBackupIndex inside the rollingPolicy element, and
have also tried a MaxHistory element inside rollingPolicy.

Could someone who has got log retention controlled within Cloudstack
share the relevant part of the config they used to achieve this
please?

Regards,

Richard