问题
I am trying to enable the log rotation for jenkins. Because the log file occupied more memory space. Is there any plugins or method to do it?
回答1:
Job Configuration -->Discard Old Builds:
There is default Log Rotation strategy:
I suggest you to click the "Advanced" button to know more about this log rotation strategy.
回答2:
Other answers here are referring to the logs generated by the individual jobs,
but if you are asking about Jenkins' main jenkins.log
file (generated by the Jenkins-server),
a bug related to that was fixed on Apr-2015 -
see here:
- Add a logrotate definition to the Jenkins Debian package definition (similar to Apache, cron-apt, aptitude and apt)
Also, you can read more about logging in Jenkins, here:
- Jenkins - Logging
回答3:
It's a default Jenkins feature and you do not need a plugin to achieve what you require. Go to job config page and check the flag at "Discard old builds" (it is right under the job's description. Then select log rotation as strategy and specify the '7' as a value for 'Days to keep builds'.
来源:https://stackoverflow.com/questions/31610924/how-to-enable-log-rotation-in-jenkins-for-weekly