Nexus Repository 2 officially sunsetted June 30, 2025. Visit my.sonatype.com for archived documentation. Migrate to Sonatype Nexus Repository 3 as soon as possible.
Nexus Repository 2, 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 Repository 2 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 Repository 2 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.