XenServer log cleaning
I believe many people are troubled by the problem of the Xenserver log filling the disk space, causing the machine to eventually hang up. I encountered it twice (once the time the pool master hanged up, and people with 200 people were unable to work for one hour). It's a headache.
The server has been used for a long time, and XenServer has generated a lot of logs, and some people even occupy space because the logs are full of space.
Causes system problems: xapi crashes, or the system is stuck, and restart is invalid.
So we should check whether the logs take up space frequently and clean up the logs
First check the usage of the system disk (XenServer defaults to 4G system space)
[root@xenserver-shptahqk log]#
df -hal
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 4.0G 4.0G 0G 100% /
none 0 0 0 - /proc
none 0 0 0 - /sys
............
You can see that the space of /dev/sda1 is full, and it is in the system and many directories. Maybe a certain directory occupies a lot of space, so we can find it and clean it up.
List the directories in the system first
cd /
ls
bin dev home media opt root srv usr
boot etc lib mnt proc sbin sys var
cli-rt EULA lost+found myiso Read_Me_First.html selinux tmp
You can see many directories, here we can check the space size of each directory one by one
du -hcs var
2G var
2G total
You can see that the var directory occupies the system and you only have 2G. Then, let's switch to this directory to see which one takes up space in the root directory
cd /var
ls
cache db games local log nis patch run swap xapi yp
crash empty lib lock mail opt preserve spool tmp xen
The log directory is here:log, check it
du -hcs log
1.9G log
1.9G total
I saw that the og directory takes up the largest space, this is the log directory, we can delete all the following files
cd log
ls
Then we can delete all the following files. If you are afraid of operation errors, just delete them one by one.
rm -rf file name
After deletion, restart the system log service
service syslog restart
If the above restart is still invalid, you need to restart xapi
service xapi restart
Thank you for reading, I hope it can help you. Thank you for your support for this site!