Question
LTIMindtree
SA
Last activity: 25 Nov 2024 1:30 EST
Logs Rotation & Aged Logs Deletion using xml configuration in Prlog4j2.xml file
I made few changes in the prlog4j2.xml file so that they can get stored in a PVC. Logs are also archiving properly. But, I have added Delete xml tags and aim to delete aged logs of the value defined in the Delete xml tag. It's not working for statefulset pods aged logs. Need a help.
Sample piece of xml i'm using with Delete Tag is:
<!-- RollingFile Appender for pegarules PERFORMANCE Alert logs -->
<RollingRandomAccessFile name="ALERT" fileName="opt/pega/app-logs/${sys:pega.logdir}.PegaRULES-ALERT.log" filePattern="opt/pega/app-logs/${sys:pega.logdir}.PegaRULES-ALERT-%d{MM-dd-yyyy}-%i.log.gz" append="true">
<PatternLayout>
<Pattern>%d{DEFAULT}{Asia/Riyadh} %m%n</Pattern>
</PatternLayout>
<ThreadContextMapFilter onMatch="DENY" onMismatch="NEUTRAL" operator="or">
<KeyValuePair key="alertType" value="security"/>
</ThreadContextMapFilter>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
<DefaultRolloverStrategy max="20">
<Delete basePath="opt/pega/app-logs/${sys:pega.logdir}" maxDepth="1">
<IfFileName glob="${sys:pega.logdir}.PegaRULES-ALERT-*.log.gz"/>
<IfLastModified age="15d"/>
</Delete>
</DefaultRolloverStrategy>
I made few changes in the prlog4j2.xml file so that they can get stored in a PVC. Logs are also archiving properly. But, I have added Delete xml tags and aim to delete aged logs of the value defined in the Delete xml tag. It's not working for statefulset pods aged logs. Need a help.
Sample piece of xml i'm using with Delete Tag is:
<!-- RollingFile Appender for pegarules PERFORMANCE Alert logs -->
<RollingRandomAccessFile name="ALERT" fileName="opt/pega/app-logs/${sys:pega.logdir}.PegaRULES-ALERT.log" filePattern="opt/pega/app-logs/${sys:pega.logdir}.PegaRULES-ALERT-%d{MM-dd-yyyy}-%i.log.gz" append="true">
<PatternLayout>
<Pattern>%d{DEFAULT}{Asia/Riyadh} %m%n</Pattern>
</PatternLayout>
<ThreadContextMapFilter onMatch="DENY" onMismatch="NEUTRAL" operator="or">
<KeyValuePair key="alertType" value="security"/>
</ThreadContextMapFilter>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
<DefaultRolloverStrategy max="20">
<Delete basePath="opt/pega/app-logs/${sys:pega.logdir}" maxDepth="1">
<IfFileName glob="${sys:pega.logdir}.PegaRULES-ALERT-*.log.gz"/>
<IfLastModified age="15d"/>
</Delete>
</DefaultRolloverStrategy>
</RollingRandomAccessFile>