Back to Geneos FAQ

SSO Agent - Log File Rotation Mechanism

Problem Copied

Does the SSO Agent automatically rotate its log file (sso-agent.log), or does this need to be managed manually?

Solution Copied

The sso-agent.log does not have built-in log rotation capabilities. However, log rotation can be configured using Logback’s RollingFileAppender with a SizeAndTimeBasedRollingPolicy. For more details and examples, visit: Logback Documentation.

SSO-Agent version 1.8.4 and later include Logback version 1.2.11 as part of their package. For more details, you may refer to: docs.itrsgroup.com/docs/all/geneos/previous-release-notes/6x-release/6x-geneos-release-notes/index.html#new-features-and-enhancements-2

Example Copied

logback.xml with SizeAndTimeBasedRollingPolicy

<configuration>
    <!--
        RollingFileAppender:
        - Logs go to logs/sso-agent.log
        - Rolls over daily and when log file size reaches 5MB
        - Keeps logs for 60 days or up to 20GB total
    -->
    <appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>logs/sso-agent.log</file>

        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!-- Log file pattern: date + index -->
            <fileNamePattern>logs/sso-agent-%d{yyyy-MM-dd}.%i.log</fileNamePattern>

            <!-- Roll over when log file reaches 5MB -->
            <maxFileSize>5MB</maxFileSize>

            <!-- Retain logs for 60 days -->
            <maxHistory>60</maxHistory>

            <!-- Cap total size to 20GB -->
            <totalSizeCap>20GB</totalSizeCap>
        </rollingPolicy>

        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{40} - %msg%n</pattern>
        </encoder>
    </appender>

    <logger name="org.xnio.nio" level="DEBUG" />
    <logger name="io.undertow.request.security" level="DEBUG" />
    <logger name="io.undertow.session" level="INFO" />
    <logger name="com.itrsgroup.ssoagent.authentication" level="DEBUG" />
    <logger name="com.itrsgroup.ssoagent.ldap" level="DEBUG" />

    <!-- Root logger -->
    <root level="DEBUG">
        <appender-ref ref="ROLLING" />
    </root>
</configuration>

Output:

Geneos - SSO Agent - Log File Rotation Mechanism

["Geneos"] ["Geneos > SSO Agent"] ["FAQ"]

Was this topic helpful?