Ability to control Ops Manager log rotation from an Admin Page in the UI
The Ops Manager Application Server Log Directory is typically located in /opt/mongodb/mms/logs/
.
Currently, the log rotation of the Ops Manager log files /opt/mongodb/mms/logs/mms0.log
, /opt/mongodb/mms/logs/daemon.log
and /opt/mongodb/mms/logs/mms0-access.log
are configured by default to rotate the log file every day and compress it with a retention of 30 days. After 30 days the compressed files are deleted.
Please allow the configuration of these log rotation settings through the Ops Manager Web UI.
Currently, this can only be done manually. The default installation of Ops Manager includes a file in /opt/mongodb/mms/conf
called logback.xml
. This is the file that the library uses to configure Ops Manager logs and log rotation for /opt/mongodb/mms/logs/mms0.log
and /opt/mongodb/mms/logs/daemon.log
. By default this is configured with the following settings:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log_path}.log</file>
<encoder class="com.xgen.svc.mms.util.HeaderPatternLayoutEncoder$Classic">
<pattern>
%d{"yyyy-MM-dd'T'HH:mm:ss.SSSZ"} [%thread] %XF{groupId, "gid:%s "}%XF{jobId, "jobId:%s "}%-5level %logger [%file.%method:%line] - %msg%n
</pattern>
</encoder>
<!-- Rollover the logs once per day, keep 30 days, compressed -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log_path}.%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
The file /opt/mongodb/mms/conf/logback-access.xml
controls rotation of the /opt/mongodb/mms/logs/mms0-access.log
. It has the same <!-- Rollover the logs once per day, keep 30 days, compressed --> policy.
The logs will be compressed and rotated each day and deleted after 30 rolling days. If you modify the maxHistory
option to 10
, this should delete the files after 10 days. Please note that any upgrade of Ops Manager may overwrite this change with a new configuration file. Additionally, after modifying these values you will need to restart Ops Manager.
The /opt/mongodb/mms/logs/mms-migration.log, mms0-startup.log and daemon-startup.log
log files are not rotated as it contains only some log entries generated during the startup/migration phases of the Ops Manager Application Server processes.
-
Charles commented
Code block with correct markup:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log_path}.log</file>
<encoder class="com.xgen.svc.mms.util.HeaderPatternLayoutEncoder$Classic">
<pattern>
%d{"yyyy-MM-dd'T'HH:mm:ss.SSSZ"} [%thread] %XF{groupId, "gid:%s "}%XF{jobId, "jobId:%s "}%-5level %logger [%file.%method:%line] - %msg%n
</pattern>
</encoder>
<!-- Rollover the logs once per day, keep 30 days, compressed -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log_path}.%d{yyyyMMdd}.log.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>