Centos7 Jenkins日志过大

时间:2024-10-02 12:36:38

df 查看 占用

[root@instance-ncwnnt0e /]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 1008756 0 1008756 0% /dev
tmpfs 1020532 0 1020532 0% /dev/shm
tmpfs 1020532 17048 1003484 2% /run
tmpfs 1020532 0 1020532 0% /sys/fs/cgroup
/dev/vda1 41152716 23703492 15702820 61% /
overlay 41152716 23703492 15702820 61% /var/lib/docker/overlay2/c9b8caf06e0ad30a31f6c07f9613fdedab8a421062ece6742c0b2be82c9fc8a4/merged
shm 65536 8 65528 1% /var/lib/docker/containers/4f10f72d7aeab949f61af6bd79567b33898482ffbbb6dd2df2a98d0177f3bc88/mounts/shm
overlay 41152716 23703492 15702820 61% /var/lib/docker/overlay2/4e9cf0a90f69dbe5d852fd8a11538ffc0eca2bcfc44b219a6c59d7a86d66bd2a/merged
shm 65536 0 65536 0% /var/lib/docker/containers/f3e20483118e8dc248a5c11b60974959e0049a02898c8e17b3fd38590cfb27eb/mounts/shm
overlay 41152716 23703492 15702820 61% /var/lib/docker/overlay2/e4ce1e7a67fdb15a01f49b4331edcdd5fbbfcd853903b82bf58bf4aafcbe2ffb/merged
shm 65536 64 65472 1% /var/lib/docker/containers/53914bcee1c41fbf162e079a5037955101dd8d0e5cc90e3d98fc50a15ad1aa7d/mounts/shm
tmpfs 204108 0 204108 0% /run/user/0
[root@instance-ncwnnt0e lib]# cd /
[root@instance-ncwnnt0e /]# sudo du -ah --max-depth=1
4.2M ./tmp
0 ./bin
3.5G ./usr
0 ./sys
139M ./root
0 ./sbin
0 ./lib
0 ./lib64
4.0K ./home
150M ./opt
du: cannot access ‘./proc/17755/task/17755/fd/4’: No such file or directory
du: cannot access ‘./proc/17755/task/17755/fdinfo/4’: No such file or directory
du: cannot access ‘./proc/17755/fd/3’: No such file or directory
du: cannot access ‘./proc/17755/fdinfo/3’: No such file or directory
0 ./proc
16K ./lost+found
4.0K ./mnt
4.0K ./srv
0 ./.autorelabel
226M ./boot
39M ./etc
20G ./var
4.0K ./flag_ok
4.0K ./media
0 ./dev
17M ./run
24G .

继续 sudo du -ah --max-depth=1

[root@instance-ncwnnt0e /]# cd var
[root@instance-ncwnnt0e var]# ls
account adm cache crash db empty games gopher kerberos lib local lock log mail nis opt preserve run spool tmp yp
[root@instance-ncwnnt0e var]# sudo du -ah --max-depth=1
20K ./tmp
4.0K ./crash
4.0K ./.updated
203M ./cache
0 ./lock
20K ./db
4.0K ./nis
3.9G ./lib
4.0K ./local
0 ./mail
4.0K ./opt
16G ./log
4.0K ./games
4.0K ./adm
120K ./spool
4.0K ./preserve
4.0K ./account
12K ./kerberos
8.0K ./empty
4.0K ./gopher
4.0K ./yp
0 ./run
20G .
[root@instance-ncwnnt0e var]#

Jenkins 日志使用 16G

[root@instance-ncwnnt0e log]# sudo du -ah --max-depth=1
716K ./messages
4.2M ./sa
5.8M ./audit
0 ./boot.log
32K ./boot.log-20190415
716K ./btmp
28K ./yum.log
4.0K ./qemu-ga
12K ./cloud-init-output.log
32K ./dmesg.old
4.0K ./grubby_prune_debug
0 ./spooler
36K ./wtmp
280K ./cloud-init.log
4.0K ./grubby
16G ./jenkins
4.0K ./anaconda
4.0K ./maillog
1.1M ./secure
4.0K ./chrony
32K ./dmesg
4.0K ./rhsm
16K ./tuned
12K ./lastlog
112K ./cron
28K ./boot.log-20190417
16G .

Centos7 Jenkins日志过大

原因:

因为DNS查询错误,返回了所有的日志数据,解决方法:

【系统管理】=》【system log】=>【日志级别】=》【Name: javax.jmdns,Level: off】

Centos7 Jenkins日志过大

[root@instance-ncwnnt0e log]# cd jenkins
[root@instance-ncwnnt0e jenkins]# ls
jenkins.log
[root@instance-ncwnnt0e jenkins]# sudo rm jenkins.log