VMware Cloud Community
harkamal
Expert
Expert
Jump to solution

Get-Logtype & Get-Log

What is the equivalent API in c# ? I am writing a plugin to query host logs from vi client and using vmware.vim.dll ... any clues please.

Thanks in anticipation

HK

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The Get-LogType cmdlet seems to use the QueryDescriptions method available on the the DiagnosticManager object.

The Get-Log cmdlet uses the BrowseDiagnosticLog method.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

The Get-LogType cmdlet seems to use the QueryDescriptions method available on the the DiagnosticManager object.

The Get-Log cmdlet uses the BrowseDiagnosticLog method.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
harkamal
Expert
Expert
Jump to solution

I am not getting more than 1000 lines of log mesages for any of the log types on the host. Tried connecting to host directly and through vCenter programatically.

VIM.DiagnosticManagerLogHeader logh = dm.BrowseDiagnosticLog(null, "messages", null, null)

logh always returns less than 1000 lines.

Whereas, "get-log -key messages" returns 7000+ lines of text

What is do different in using api's and cmdlets ?

I am writing a client plugin to view host logs, so i need to get into api's

Thanks in anticipation

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The info about the DiagnosticManager in the SDK Reference doesn't seem to be complete/correct.

With the following script you fetch all lines (in reverse chronological order)

$esxName = <hostname>
$esx = Get-VMHost -Name $esxName
$si = Get-View ServiceInstance
$dm = Get-View $si.Content.diagnosticManager
$log = @()
$logpart = $dm.BrowseDiagnosticLog($esx.Extensiondata.MoRef,"messages",$null,$null)
$nrlines = $logpart.LineEnd - $logpart.LineStart + 1
$log += $logpart.LineText
while($nrlines -eq 1000){
	$logpart = $dm.BrowseDiagnosticLog($esx.Extensiondata.MoRef,"messages",$logpart.LineEnd + 1,$null)
	$nrlines = $logpart.LineEnd - $logpart.LineStart + 1
	$log += $logpart.LineText
}

The array $log will contain all lines.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
harkamal
Expert
Expert
Jump to solution

Thanks LucD. But is this a bug or server limitation ? If it is a server side settings, then can we change it...AdvancedOption may be ?

I will try the solution and feedback.

Good night.

0 Kudos