Skip to content

Commit

Permalink
skel,logback: make the .resilience and .qos log files singletons
Browse files Browse the repository at this point in the history
Motivation:

Unlike the .access or .event logs, the logs tracking
.qos and .resilience messages are only relevant to those
domains.

Modification:

Fix logback.xml so that only a single log file for resilience
(`resilience-activity.log`) is produced on a given dCache node.

Also, implement a similar appender for .qos (which will
eventually replace resilience).  (Note that the code
already existed to write to the `qos-log` in the
various message handlers, but adding this to
`logback.xml` was overlooked.

Result:

No redundant replications of unused log files,
and qos activity is now recorded as well.

Target: master
Request: 9.1
Request: 9.0
Request: 8.2
Requires-notes: yes (the new file names should be obvious, though)
Patch: https://rb.dcache.org/r/14068/
Acked-by: Lea
  • Loading branch information
alrossi committed Aug 25, 2023
1 parent 2cd9410 commit bfe7659
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions skel/etc/logback.xml
Expand Up @@ -80,7 +80,6 @@
</else>
</if>


<appender name="pinboard" class="dmg.util.PinboardAppender">
<layout>
<pattern>${dcache.log.format.pinboard}</pattern>
Expand Down Expand Up @@ -150,27 +149,32 @@
</then>
</if>


<appender name="resilience" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${dcache.log.dir}/${dcache.domain.name}.resilience</file>
<file>${dcache.log.dir}/resilience-activity.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${dcache.log.dir}/${dcache.domain.name}.resilience.%d{yyyy-MM-dd}.gz</fileNamePattern>
<fileNamePattern>${dcache.log.dir}/resilience-activity.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>${dcache.log.resilience.max-history}</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${dcache.log.format.file}</pattern>
</encoder>
</appender>

<appender name="qos" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${dcache.log.dir}/qos-activity.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${dcache.log.dir}/qos-activity.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>${dcache.log.qos.max-history}</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${dcache.log.format.file}</pattern>
</encoder>
</appender>

<if condition='!"${dcache.log.level.kafka}".equals("off")'>
<then>

<!-- This is the kafkaAppender -->


<appender name="kafka" class="com.github.danielwegener.logback.kafka.KafkaAppender">


<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.dcache.alarms.logback.MarkerJsonLayout">

Expand All @@ -181,7 +185,6 @@
<prettyPrint>true</prettyPrint>
</jsonFormatter>
</layout>

</encoder>
<!-- Regardless of the level to which the kafka appender is set,
only messages marked as ALARM are allowed through -->
Expand All @@ -193,10 +196,7 @@
<!-- producer configs are documented here: https://kafka.apache.org/documentation.html#newproducerconfigs -->
<!-- bootstrap.servers is the only mandatory producerConfig -->
<producerConfig>bootstrap.servers=${dcache.kafka.bootstrap-servers}</producerConfig>

</appender>


</then>
</if>

Expand Down Expand Up @@ -231,6 +231,10 @@
<appender-ref ref="resilience"/>
</logger>

<logger name="org.dcache.qos-log" additivity="false">
<appender-ref ref="qos"/>
</logger>

<!-- Nothing is logged to this logger. Its sole purpose is to list
all appenders available; this ensures that the appenders are
available in the dCache admin interface. -->
Expand Down Expand Up @@ -364,5 +368,11 @@
<level>${dcache.log.level.resilience}</level>
</threshold>

<threshold>
<appender>qos</appender>
<logger>org.dcache.qos-log</logger>
<level>${dcache.log.level.qos}</level>
</threshold>

</turboFilter>
</configuration>

0 comments on commit bfe7659

Please sign in to comment.