How can I set a maximum number of rotated log files for Nexus to keep?

Nexus as shipped does not limit the number of rotated log files (rotated log files are compressed though).  If you want to set a maximum, edit "${nexus-work"/conf/logback-nexus.xml and look for the following section:

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <fileNamePattern>${appender.file}.%d{yyyy-MM-dd}.gz</fileNamePattern>
</rollingPolicy>

Then add a line to it specifying how many days of logs you would like Nexus to keep:

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <fileNamePattern>${appender.file}.%d{yyyy-MM-dd}.gz</fileNamePattern>
    <!-- keep log files for 30 days -->
    <maxHistory>30</maxHistory>
</rollingPolicy>

The change will be picked up automatically, there is no need to restart the server.

Newer versions of Nexus also ship with a request.log enabled.  To set the maximum number of rotated logs for the request log edit $NEXUS_HOME/conf/logback-access.xml, and set the "maxHistory" variable as above.  By default Nexus ships with a limit of 90 for this value.

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk