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?
Each file should be rotated weekly. The log rotation job runs nightly, though, so this can be changed to daily for a specific log file if desired. The three commands that specify how often rotation should take place are daily, weekly and monthly. Keep four sets of log files.
If you want to rotate /var/log/syslog it needs to be listed in a logrotate config file somewhere, and you just run logrotate . If it rotated recently, then logrotate -f to force it to do it again. So, you need that in a file, normally either /etc/logrotate. conf or as a file snippet in /etc/logrotate.
If you want to want to monitor all the Jenkins instances, then you need to install filebeat in all the instances and ships the application log to logstash. Here, we will ship the application logs of one Jenkins instance only. Below is the filebeat. yml to monitor jenkins log file.
In information technology, log rotation is an automated process used in system administration in which log files are compressed, moved (archived), renamed or deleted once they are too old or too big (there can be other metrics that can apply here).
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.
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:
Also, you can read more about logging in Jenkins, here:
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'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With