VMware Cloud Community
edevlin
Contributor
Contributor
Jump to solution

/var/log - files safe to delete

Hi All,

On 1 of my ESX hosts the /var/log folder has grown to the point its causing me issues creating VM's etc..from looking at the files in this folder some are big in size particularly sercure.1 and secure.2 (both over 200MB) my question is, is it safe to delete these files? I also have lots of vmkernel.* is it also safe to purge these files?

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

The files you see with the .1, .2, ... extensions are archived log files resulting from the log file rotation. Log files are usually rotated based on their size and/or when a host or VM is powered on. You can delete these rotated log files if you want to free up disk space. I don't recommend you delete the ".log" files though, because these are usually the current ones (except for the virtual machine log files).

However, if the logfiles have such a size there's got to be be a reason for it. I'd recommend you first take a look at the log files to find out whether there's an issue which needs to be resolved before deleting them.

André

View solution in original post

Reply
0 Kudos
8 Replies
MauroBonder
VMware Employee
VMware Employee
Jump to solution

Hello,

Might this kb can be useful for your problem.

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100356...


Please, don't forget the awarding points for "helpful" and/or "correct" answers. 

Mauro Bonder - Moderator

*Please, don't forget the awarding points for "helpful" and/or "correct" answers. *Por favor, não esqueça de atribuir os pontos se a resposta foi útil ou resolveu o problema.* Thank you/Obrigado
edevlin
Contributor
Contributor
Jump to solution

Hi I did see that post online however doesn't say if I can delete these specific files can you advise?

Thanks

Reply
0 Kudos
MauroBonder
VMware Employee
VMware Employee
Jump to solution

To get a count on the number of vmware-x.log files in the folder, run:

# ls *.log | wc -l


To remove the logs, run:


# rm -f vmware-*.log


This deletes all log files, unless there are too many arguments. That is, too many files for the rm command to handle. In this case, try deleting all files beginning with vmware-1:


# rm -f vmware-1*.log


If  there are tens of thousands of files, there may be over a thousand  beginning with 1, so again too many arguments. You must be more  specific:


# rm -f vmware-10*.log
# rm -f vmware-11*.log
# rm -f vmware-12*.log


If necessary, continue to narrow down the command's deletion candidates
until you reach an acceptable file count.

Keep removing the log files until only vmware.log remains. Repeat for any other virtual machines affected.


*Please, don't forget the awarding points for "helpful" and/or "correct" answers. *Por favor, não esqueça de atribuir os pontos se a resposta foi útil ou resolveu o problema.* Thank you/Obrigado
Reply
0 Kudos
edevlin
Contributor
Contributor
Jump to solution

When I run the first command the count is 3 however from viewing inside this folder I don't have many vmware-* files, the files that are eating my space begin secure.* - these files are rather large in size and its these files specifically I would like to know if they are ok to delete?

Thanks

Reply
0 Kudos
MauroBonder
VMware Employee
VMware Employee
Jump to solution

Authentication log - /var/log/secure - Contains records of  connections that require authentication, such as VMware daemons and  actions initiated by the xinetd daemon.

go ahead

*Please, don't forget the awarding points for "helpful" and/or "correct" answers. *Por favor, não esqueça de atribuir os pontos se a resposta foi útil ou resolveu o problema.* Thank you/Obrigado
Reply
0 Kudos
a_p_
Leadership
Leadership
Jump to solution

The files you see with the .1, .2, ... extensions are archived log files resulting from the log file rotation. Log files are usually rotated based on their size and/or when a host or VM is powered on. You can delete these rotated log files if you want to free up disk space. I don't recommend you delete the ".log" files though, because these are usually the current ones (except for the virtual machine log files).

However, if the logfiles have such a size there's got to be be a reason for it. I'd recommend you first take a look at the log files to find out whether there's an issue which needs to be resolved before deleting them.

André

Reply
0 Kudos
AndreTheGiant
Immortal
Immortal
Jump to solution

Sound strange that the log files grow so fast.

Check the content to verify if there are some errors.

In any case you can change how logrotate handle those files, and for example reduce the number of version, or increase the frequency.

Andre

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
Reply
0 Kudos
shishir08
Hot Shot
Hot Shot
Jump to solution

To prevent concurrent changes to critical virtual machine files and file systems, ESX hosts establish locks on these files. In certain circumstances these locks may not be released when the  virtual machine is powered off. The files cannot be accessed by the servers while locked, and the virtual machine is unable to power on.

There are many log files but you have to decide which one is useful for you and make sure that less important logs do not take much space.

Keep the vmware.log file and the necessary ones to you and delete rest.Also go through the log file as what is the reason of file size is hitting so high limit.

Several ESX host log files are controlled by the Linux logrotate program. With ESX server, logrotate is executed hourly using the /etc/cron.daily/logrotate command. From there, logrotate uses its configuration file /etc/logrotate.conf. By default, that file references the directory /etc/logrotate.d to find out which log files it needs to rotate.

Reply
0 Kudos