Rolling file appender in docker image

Daniel Lutz daniel.lutz at switch.ch
Fri Jan 13 13:49:36 UTC 2023


Mathew, Sunil via users schrieb/wrote (13.01.23 09:11):
> I am writing logs to log file in the docker image. The issue is that the logback.xml
> in the docker image has FileAppender instead of RollingFileAppender (as is in the standard
> Shibboleth install) and so the file is growing in size inside the docker container without
> rolling over. Is there a reason why the docker image logback.xml is not using RollingFileAppender?

You should log everything to the container's stdout instead.

We use the following Logback configuration in our containers to log everything to the console (i.e. stdout).
With this configuration, the IdP's logs are available via the container's logs (e.g. "docker logs <container>").
(We start the containers with the "journald" log driver, such that all logs from the container
are sent to the host's jornald.)


/opt/shibboleth-idp/conf/logback.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
     ...
     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
         <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
             <charset>UTF-8</charset>
             <Pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} [%5level] : %logger: %msg%n</Pattern>
         </encoder>

         <!-- or to log in JSON format -->
         <!--
         <encoder class="net.logstash.logback.encoder.LogstashEncoder">
             <timeZone>UTC</timeZone>
         </encoder>
         -->
     </appender>

     <logger name="Shibboleth-Audit" level="ALL">
         <appender-ref ref="${idp.audit.appender:-CONSOLE}"/>
     </logger>

     <logger name="Shibboleth-FTICKS" level="ALL" additivity="false">
         <appender-ref ref="${idp.fticks.appender:-CONSOLE}"/>
     </logger>

     <logger name="Shibboleth-Consent-Audit" level="ALL">
         <appender-ref ref="${idp.consent.appender:-CONSOLE}"/>
     </logger>

     <root level="${idp.loglevel.root:-INFO}">
         <appender-ref ref="${idp.process.appender:-CONSOLE}"/>
         <appender-ref ref="${idp.warn.appender:-CONSOLE}" />
     </root>
</configuration>


(You need to ensure that the "idp.*.appender" properties are not set
or set to "CONSOLE".)


   Daniel


More information about the users mailing list