Jenkins日志越来越大并填满了整个磁盘空间 [英] Jenkins log getting huge and filling up entire disk space

查看:398
本文介绍了Jenkins日志越来越大并填满了整个磁盘空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个星期我都对我的Jenkins服务器打到Jenkins日志使用的100%磁盘感到惊讶.

Every week I got surprised by my Jenkins server hitting 100% disk used by Jenkins log.

所以我删除了文件,然后磁盘又获得了很多可用空间.

So I remove the file, and then my disk gets lots of free space again.

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        987M   60K  987M   1% /dev
tmpfs           997M     0  997M   0% /dev/shm
/dev/xvda1       32G   32G     0 100% /         <============================= DISK FULL

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo rm /var/log/jenkins/jenkins.log <======= REMOVE LOG FILE

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        987M   60K  987M   1% /dev
tmpfs           997M     0  997M   0% /dev/shm
/dev/xvda1       32G   11G   21G  35% /         <============================= FREE SPACE AGAIN

我的日志级别配置为:

Name                | Level
----------------------------------
winstone            | 5
org.apache.sshd     | WARNING
                    | INFO

我该如何彻底预防此问题?

How can I definitively prevent this problem?

推荐答案

对于那些从战争中逃脱的人,甚至最初是一些打包的安装程序,这都是一个普遍的问题,请参见

This is a common problem for anyone running from the war, and even originally some of the packaged installers, see JENKINS-8641

默认情况下,Jenkins不包括系统日志轮换,因此最终它将填充磁盘.最终取决于您使用Jenkins的数量以及可用的磁盘空间.

By default, Jenkins did not include system log rotation, so eventually it will fill the disk. Eventually determined by how much you use Jenkins and the disk space available.

此cloudbees文档描述了如何使用 logrotate .链接到手册页.您甚至可以启用独立的战争执行.

This cloudbees doc describes how to use logrotate. Link to man page. You can enable even for standalone war execution.

/var/log/jenkins/jenkins.log {
        weekly
        copytruncate
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
}

通常该文件可以在/etc/logrotate.d/jenkins/etc/logrotate.d/jenkins-oc中找到.

Normally this file would be found in /etc/logrotate.d/jenkins or /etc/logrotate.d/jenkins-oc.

您可能希望设置为每天轮换并仅保留一周(轮换为7),或者根据maxsize或组合设置特定的限制.

You may want to set to rotate daily and retain only a week (rotate 7), or set specific limits based on maxsize or a combination.

您可以在此处阅读有关登录Jenkins的更多信息:

You can read more about logging in Jenkins, here:

JENKINS-记录

JENKINS-日志记录配置

另请参见相关的在超级用户中记录Q

.

这篇关于Jenkins日志越来越大并填满了整个磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆