Log file rotation


  • The log files in /var/log/jenkins on my Jenkins master are rapidly growing and using up disk space. What is the best way to roll over logs without impacting the Jenkins operations and version upgrades?


  • CloudBees Jenkins Operations Center
  • CloudBees Jenkins Enterprise


The log file location may vary depending on your system. For most Linux systems, by default the Jenkins Enterprise logs should be in /var/log/jenkins (or /var/log/jenkins-oc for Jenkins Operations Center)

The logrotate utility manages how the log files are rotated and compressed. Type man logrotate at the command-line to see a detailed list of the various options, including some good examples. Or alternatively, this Understanding logrotate Utility article offers a pretty good summary and includes examples.

The logrotate utility includes some frequently used options, such as compression, timeframe, and size of a log before rotation occurs.

If you are not encountering issues with log rotation and sizes, and for most small to medium-sized Jenkins instances - it’s probably best to let logrotate work with it’s default behavior. Here is an example of a configuration which includes good basic settings (normally this file would be found in /etc/logrotate.d/jenkins or etc/logrotate.d/jenkins-oc):

/var/log/jenkins/jenkins.log {
        rotate 52

If you have a larger Jenkins instance, or if the logs are located on a NAS (perhaps linked to /var/log/jenkins), beware that latency or connection issues between the Jenkins master and the NAS/filesystem may result in logging issues.

Also please ensure the Jenkins administrator is the owner and has the correct read/write permissions to the directory and filesystem.

Related Articles:
* Why is my Jenkins access log empty?
* Changing location of log file

Have more questions? Submit a request


Please sign in to leave a comment.