- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone!
Our infrastructure based on vSphere 5.5. Recently, I have noticed that some virtual machines does not contain vmware.log files. I need to find the root cause of it.
Any suggestions?
I think that the right strategy is to define all VMs with similar problems and then, investigate one by one. The problem is that the infrastructure is quite big, hence,
it is not a good way to browse each datastore and looked in each vm folder. Does anybody know how to get a list of VMs, which does not contain vmware.log or vmware-x.log files?
PowerCLI command may be?
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you looking for VMs where "Enable logging" is off?
Or for VMs where "Enable logging" is on, but no vmware.log files are created?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am not sure about powercli, I may follow this in case I want to find this information
1. Login to ESXi host which has all the datastores mapped
2. Use general linux "find" command to find the vmware.log file on all datastores
3. This will give you list of all vmware.log file from all folders may be lengthy one depends on number of VMs
4. copy the data to a file
5. Read the file and use cut command to get the fourth column i.e /vmfs/volumes/<DS name>/<vm folder>/vmware.log , fourth column is the VM name.
6. Compare this list with your VM inventory list exported from vCenter or some other tool, whichever VM is missing, then that VM does not have the log file.
Note: This output may not be very accurate if your VM name and VM folder name is different. However, it may help you to some extent.
Suresh
https://vconnectit.wordpress.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have noticed that some virtual machines does not contain vmware.log files. I need to find the root cause of it.
There's been an issue with growing log files (up to several GB), especially for Windows Terminal-Servers. This often caused disk space issues on the datastores.
Maybe this happened in the past, and someone disabled logging for such VMs (VM settings -> Options -> General).
You can use the following command to list the VMs with their current setting.
Get-VM | %{$M = Get-View $_ ; Write-Host $M.Name " - " $M.Config.Flags.EnableLogging}
André
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello LucD!
The environment contain thousands VMs. First of all, I need to find those VMs, where "Enable Logging" is ON, but vmware.log files does not exist for some reasons (this is a problem). After that, starting investigating the root cause of such strange behavior.
To enable logging for VMs via Power CLI we can use your article: http://www.lucd.info/2011/02/27/virtual-machine-logging/
![]()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Sureshkumar M!
Thank you for your answer. It should be an option. My concerns was similar, but I thought to use PowerCLI. Idea was to list all VMs, which does not vmware.log files in their folders in all datastores. List all VMs, and then, look for a different. The problem is I am not really good at PowerCLI, and I need somebody provide me an appropriate command.
Anyway, thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you check if the following already lists the problematic VMs, at least for the powered on VMs.
You should check those where the LogFiles column shows 0.
This would avoid having to do an actual dir of the VM's folder.
Get-View -ViewType VirtualMachine -Property Name,Config.Flags,Config.Files.LogDirectory,Layout.LogFile,Runtime.PowerState |
where{$_.Config.Flags.enableLogging -eq $true} | %{
$_ | Select Name,
@{N='PowerState';E={$_.Runtime.PowerState}},
@{N='LogDirectory';E={$_.Config.Files.LogDirectory}},
@{N='LogFiles';E={$_.Layout.LogFile.Count}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello André!
Thank you so much for your help! It is useful. How to export this list to csv file?
P.S.
Can you recommend me a book or so for the good PowerCLI start ? Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LucD, I have run this script and check the result. LogFiles = "0" only for part of powered OFF virtual machines. All powered ON virtual machines have status different from "0", such as 6,7,4,1,5,3..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can export to a CSV like this
$report = Get-View -ViewType VirtualMachine -Property Name,Config.Flags,Config.Files.LogDirectory,Layout.LogFile,Runtime.PowerState |
where{$_.Config.Flags.enableLogging -eq $true} | %{
$_ | Select Name,
@{N='PowerState';E={$_.Runtime.PowerState}},
@{N='LogDirectory';E={$_.Config.Files.LogDirectory}},
@{N='LogFiles';E={$_.Layout.LogFile.Count}}
}
$report | Export-Csv report.csv -NoTypeInformation -UseCulture
On the learning resources, there are two parts you would have to tackle.
PowerShell, and then PowerCLI, you can learn those in parallel.
Have a look at New to PowerCLI. Book recommendations
There are many resources available, free and for a price.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
André, you command helped me to define that some VMs were really not have enabled logging option. Thank you once again. This partially helped.