Logrotating edge-message-processor.log

Not applicable

For our log /opt/apigee/var/log/edge-message-processor/edge-message-processor.log we are trying to implement log rotation as follows in /opt/apigee/edge-message-processor/source/conf/logback.xml

<appender name="EDGE_MESSAGEPROCESSOR_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${data.dir:-..}/edge-message-processor.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- rollover daily -->
            <fileNamePattern>${data.dir:-..}/edge-message-processor-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
            <!-- keep max of 10 days -->
            <maxHistory>10</maxHistory>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <!-- or whenever the file size reaches 50MB -->
                <maxFileSize>50MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="com.apigee.logging.MaskPatternLayout">
                <patternsProperty>${sensitiveDataPattern}</patternsProperty>
                <pattern>${defaultPattern}</pattern>
            </layout>
        </encoder>
    </appender>


<logger name="EDGE_MESSAGEPROCESSOR_LOG" level="INFO" additivity="false">
        <appender-ref ref="EDGE_MESSAGEPROCESSOR_LOG"/>
    </logger>

We restarted MP, but its not working. Log file is now 100MB and also we waited for 2 days. We can see other files like "TRANSACTION_LOGS" are working fine. Issue is with this file only.

1 2 880
2 REPLIES 2

Hi,

I also had the same issue and had to do use a different rotating policy for it to work:

Add this to the file: /opt/apigee/edge-message-processor/source/conf/logback.xml

<appender name="EDGE_MESSAGEPROCESSOR" class="ch.qos.logback.core.rolling.RollingFileAppender">
	<file>${data.dir:-..}/edge-message-processor.log</file>
	<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
		<fileNamePattern>${data.dir:-..}/edge-message-processor.log.%i.zip</fileNamePattern>
		<minIndex>1</minIndex>
		<maxIndex>5</maxIndex>
	</rollingPolicy>
	<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
		<maxFileSize>50MB</maxFileSize>
	</triggeringPolicy>
	<encoder>
		<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
		<!-- old-style log format
		<pattern>%5level [%thread] %date{ISO8601} %F (line %L) %msg%n</pattern>
		-->
	</encoder>
</appender>


<root level="INFO">
	<appender-ref ref="EDGE_MESSAGEPROCESSOR" />
</root>

Hope it helps...

does this create a zip file? i can see it creating one for me after making the change