powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Get-Log



NAME
Get-Log

SYNOPSIS
Retrieves entries from vSphere logs.

SYNTAX
Get-Log [-Key] [[-VMHost] ] [[-StartLineNum] ] [[-NumLines] ] [-Server []>] []

Get-Log [[-VMHost] ] [-Bundle] [-DestinationPath] [-Server ] [-RunAsync] [ ameters>]


DESCRIPTION
Retrieves entries from vSphere logs. Returns portions of the log files according to the criteria provided by the cm
dlet parameters.
To specify a server different from the default one, use the -Server parameter.


PARAMETERS
-Key
Specify the key identifier of the log file you want to retrieve. Passing values to this parameter through a pip
eline is deprecated and will be disabled in a future release.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-VMHost
Specify the hosts for which you want to retrieve logs. If no value is given to this parameter, the command retu
rns logs only for the default vSphere server.

Required? false
Position? 2
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-StartLineNum
Specify the start line number for reading from the logs.

Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false

-NumLines
Specify the number of the lines you want to retrieve from the logs.

Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Server
A vSphere servers to apply the command on. If no value is given to this parameter, the command runs on the serv
er currently specified in the $DefaultVIServer variable.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Bundle
Indicate whether to retrieve a diagnostic bundle of logs from the vSphere server.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-DestinationPath
Specify a local file path where you want to save the log bundle.

Required? true
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false

-RunAsync
Indicate that the command returns immediately without waiting for the task to complete. In this mode, the outpu
t of the cmdlet is a Task object. For more information about the -RunAsync parameter run " help About_RunAsync"
in the vSphere PowerCLI console.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
Log or LogBundle


NOTES




-------------- Example 1 --------------

C:\PS>$keys = Get-LogType

Get-Log -Key $keys[0]


Obtain the available keys. Obtains the first log file from the currently connected vSphere server.





-------------- Example 2 --------------

C:\PS>$host = Get-VMHost Host

$keyList = Get-LogType -VMHost $host

$host | Get-Log -Key $keyList[0] -StartLineNum 1 -NumLines 100


Retrieve the first one hundred log lines for the specified host and key.





-------------- Example 3 --------------

C:\PS>Get-VMost Host | Get-Log -Bundle -DestinationPath "D:\VMHostBundeLog"


Retrieve a bundle log for the specified host.






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Get-Log.html
Get-LogType