【连载】vSphere 4.0 问答(7) --- 如何删除/清理vCenter日志?

本文介绍了一种清理vCenter日志的方法,包括停止服务、备份日志、删除旧日志及重启服务等步骤,确保vCenter日志的正常轮转。

 ================================================

声明:本文是本人个人兴趣所致,自行翻译,翻译并不完全按照原文,错漏
在所难免。如因参照本文实施而造成的数据丢失/系统损坏,请自行承担,本
人不负任何责任。如非商业用途,本文可以随便转载,但请注明作者和出处
================================================


问:如何删除/清理vCenter日志?
答:vCenter日志以文本文件的形式保存在vCenter服务器上,默认位置是
C:\Documents & Settings\All Users\Application Data\VMware\VMware Virtual Center\Logs.
因为当vCenter Server 服务运行的时候,最新版本的日志文件正在使用中,所以如果要清理的话,必须先暂时停下此服务。

步骤:
1. 停止 VMware vCenter Server 服务
2. 打开资源管理器并找到C:\Documents & Settings\All Users\Application Data\VMware\VMware Virtual Center\Logs
3. 如果需要将日志文件归档的话,可以选择所有vpxd-*.log文件,发送到一个压缩文件,并取一个有意义的文件名(比如2010Jan-Dec-vCenter-Log.zip),并把这个归档文件保存到一个安全的地方
4. 删除该目录中的内容,包括vpxd-index索引文件
5. 重启VMware vCenter Server 服务
6. 查看并验证 vpxd-*.log文件(包括起第一个日志vpxd-0.log)应该已经被创建了。

注意:停掉VMware vCenter Server 服务并不会影响到任何虚机的运行。但是,vSphere Client的连接会被重置。此外,所有日志文件会被自动以Tar+Gzip方式压缩,并且会以循环覆盖的方式保存9个(默认值)历史记录和一个当前的日志记录。

delxu文档,转载请注明出处http://to.ly/78FA

-----------------------原文分割线--------------------------------


Deleting/Cleaning up vCenter logs 

The vCenter logs are stored as text files located in the file system of the vCenter server. By default, they are located at C:\Documents & Settings\All Users\Application Data\VMware\VMware Virtual Center\Logs. Since the most recent log file is in use when the vCenter server service is running, it must be stopped temporarily if you are to clean them out.   

1.     Stop the “VMware vCenter Server” service. 
2.     Navigate to C:\Documents & Settings\All Users\Application Data\VMware\VMware Virtual Center\Logs. 
3.     Consider saving an archive copy of the log files. Select the vpxd-*.log files and send to “Compressed Folder.” Rename the .zip file to something meaningful 
       (include the current date as part of the filename). Move the .zip file to a safe location. 
4.     Delete the contents of C:\Documents & Settings\All Users\Application Data\VMware\VMware Virtual Center\Logs, including the vpxd-index file. 
5.     Restart the “VMware vCenter Server” service. 
6.     Verify that the vpxd-*.log file and the first log (vpxd-0.log) have been created. 

Stopping the vCenter Server service will not affect the availability of any guest servers. However, any existing vSphere Client connections will be reset. 
Also, all logs are automatically compressed using Tar + Gzip and rolls through a default of 9 historical copies plus the current log.

### 如何安全地使用 `rm -rf` 命令 为了确保在执行命令时不会误删重要数据,以下是针对删除 `/etc/vmware-vsphere-client/SerenityDB/serenity/` 路径下所有文件的安全方法: #### 安全措施 1. **确认目标路径** 在运行任何破坏性命令之前,请先验证要清理的目标目录是否存在以及其中的内容。可以通过以下命令查看该目录下的文件列表: ```bash ls -la /etc/vmware-vsphere-client/SerenityDB/serenity/ ``` 2. **模拟删除过程** 使用 `-i` 参数让系统提示每次删除前的确认动作(仅限少量文件)。如果需要批量处理大量文件,则可跳过此步,但仍建议测试环境先行试验。 ```bash rm -ri /etc/vmware-vsphere-client/SerenityDB/serenity/* ``` 3. **实际执行删除操作** 当确信无误后,再正式执行清除指令。注意添加通配符 `*` 来匹配子项而非整个父级文件夹本身。这样能够避免意外移除更高层结构的数据。 ```bash rm -rf /etc/vmware-vsphere-client/SerenityDB/serenity/* ``` 4. **重启服务恢复功能** 清理完成后记得重新启动 vSphere Client 使更改生效并恢复正常运作状态。具体做法如下所示: ```bash service vsphere-client restart ``` 以上步骤有助于减少因人为失误带来的风险隐患。 ```bash ls -la /etc/vmware-vsphere-client/SerenityDB/serenity/ rm -ri /etc/vmware-vsphere-client/SerenityDB/serenity/* rm -rf /etc/vmware-vsphere-client/SerenityDB/serenity/* service vsphere-client restart ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值