#6010 Add logrotate to jenkins master
Closed: Fixed 3 years ago Opened 3 years ago by pingou.

When trying to restart jenkins today I found out it had a 15G log file in /var/log/jenkins/jenkins.log, we should configure logrotate for this.


Metadata Update from @pingou:
- Issue tagged with: easyfix

3 years ago

I can try to work on this if someone guides me. I don't have experience with Jenkins but I'll google my way trough.

So, this doesn't really need any jenkins knowhow. ;) You just need to make a logrotate config file for that file. Look at 'man logrotate.conf' and see /etc/logrotate.d/ on any fedora/rhel system. We just likely want it to rotate weekly and keep say 4 weeks and compress.

We should get it upstreamed to the jenkins package, but we can add it in ansible in the mean time.

Hopefully that helps clarify things...

Hey Kevin, thanks a lot for the clarifications.
I've took a look at the manual for logrotate and I came up with this:

/var/log/jenkins/jenkins.log {
    rotate 5
    weekly
    compress   
    postrotate
        /sbin/killall -HUP syslogd
    endscript
}

But I'm still confused. I've read the sys admin guide on ssh, on how to configure my client but I don't know what systems can I access, which are the ip adresses that I can log on and how to add things to ansible..

@metonym,
send your patch to the mailing list with a description of what it is and what should be done with it. infra apprentices don't have push access to the git repo.

Hey Kevin, thanks a lot for the clarifications.
I've took a look at the manual for logrotate and I came up with this:
/var/log/jenkins/jenkins.log {
rotate 5
weekly
compress
postrotate
/sbin/killall -HUP syslogd
endscript
}

But I'm still confused. I've read the sys admin guide on ssh, on how to configure my client but I don't know what systems can I access, which are the ip adresses that I can log on and how to add things to ansible..

Hey Kevin, thanks a lot for the clarifications.
I've took a look at the manual for logrotate and I came up with this:
/var/log/jenkins/jenkins.log {
rotate 5
weekly
compress
postrotate
/sbin/killall -HUP syslogd
endscript
}

So in this case the HUP syslog there likely should be 'service restart jenkins' or if you can look into jenkins and see if there's a signal to send it to reopen it's logs you could just use that.

But I'm still confused. I've read the sys admin guide on ssh, on how to configure my client but I don't know what systems can I access, which are the ip adresses that I can log on and how to add things to ansible..

So, if you have configured your ssh client as per the guide, you should be able to from your machine:

ssh batcave01.phx2.fedoraproject.org

batcave01 is our ansible control master and git host (along with other stuff). Once you get logged in there you can do:

git clone /git/ansible

and get a local copy of our ansible repo. Then you are going to want to create your jenkins.conf logrotate file under ansible/roles/jenkins/master/files/ and then add a short ansible task to ansible/roles/jenkins/master/tasks/main.yml that copies that file into place in /etc/logrotate.d

Once thats in place, do 'git add -A .' then 'git commit -a' and type a commit message. That will commit your changes, but not push them (you cannot do that as an an apprentice), but you can then do:
git format-patch HEAD^ which tells get to make a patch out of the last commit. Then you can attach that here or mail it to the list to be reviewed and applied.

Clear as mud? Happy to help out or expand on any of the above here or on irc.

Thanks for working on this! :heavy_multiplication_x:

Thank you for the effort explaining me what to do, it has helped me a lot!
I created and send the patch to the infra list. :smile:

Excellent. I've applied that and pushed it out.

Thanks again!

:wave:

Metadata Update from @kevin:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata