Log Rotation does not work


I have taken over a project and find that old jobs are not discarded which fills up disk space.
As a consequence I have to delete old jobs from time to time.
Jenkins version is 2.190.3.

Is there maybe some particular detail that I might not have considered ?


The jobs are probably not configured to remove their old logs. Build discarder is not enabled by default.

The “Configuration slicing plugin” will allow you modify the definitions of many jobs with a single operation. That may help you free some disc space.

The build discarder is enabled.
I have attached a little screenshot.

Is there another place I can check ?


I use

$ du -x $JENKINS_HOME | sort -r -n | less

to show where the disc space is being used, and then investigate the jobs or other data sources that are using that disc space. If all the jobs are configured to discard builds after 3 days, then there may be other issues. In any case, finding the source of high disc use will let you decide your next action.

we have already identified the job that consumes a lot of disk space
and thus we wish Jenkins deleted jobs that are older than 3 days,
but we have found that log rotation does not work.

I’m not aware of any bug report that declares that log rotation does not work. Of course, you’re running a Jenkins version that was released two years ago and has been superseded by multiple releases with security fixes in Jenkins core and likely in the Jenkins plugins that you are using.

You may need to remove the old build logs yourself with file system commands if the build discarder is unable to do it.

Thank you Mark.
Indeed we are going to upgrade soon and I will check again.

also the days of old build only fires when the build is run, so build on day 4 will clean up logs from day 1.

I think the newer version of the plugin and core actually will go do it outside of the build cycle, but not 100% sure on that (I personally use # of builds, so never did a time based cleanup.

Good point !
Whatever the behavior may be, we require a cleanup latest when a new build is launched in order to not use entirely up disk space.

Problem has disappeared after we have performed a restart of Jenkins service.
Issue closed.
Thank you for your comments and attention.