How to enable log rotation in Jenkins for weekly?

一笑奈何 提交于 2020-01-01 04:52:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!