Skip to content

Instantly share code, notes, and snippets.

@mbentley
Last active December 13, 2016 13:42
Show Gist options
  • Select an option

  • Save mbentley/cf09adee495c3cadb0b01e8e138be021 to your computer and use it in GitHub Desktop.

Select an option

Save mbentley/cf09adee495c3cadb0b01e8e138be021 to your computer and use it in GitHub Desktop.
Windows Server 2016 Docker Daemon Logs
# from https://github.com/Microsoft/Virtualization-Documentation/blob/live/windows-server-container-tools/Debug-ContainerHost/Debug-ContainerHost.ps1#L175
Write-Output "Warnings & errors from the last 24 hours"
$logStartTime = (Get-Date).AddHours(-24)
$logNames = "Microsoft-Windows-Containers-Wcifs/Operational",
"Microsoft-Windows-Containers-Wcnfs/Operational",
"Microsoft-Windows-Hyper-V-Compute-Admin",
"Microsoft-Windows-Hyper-V-Compute-Operational",
"Application"
$levels = 3,2,1,0
$providers = "Docker", "Microsoft-Windows-Hyper-V-Compute"
$events = Get-WinEvent -FilterHashtable @{Logname=$logNames; StartTime=$logStartTime; Level=$levels; ProviderName=$providers} -ErrorAction Ignore
$eventCsv = "logs_$((get-date).ToString("yyyyMMdd'-'HHmmss")).csv"
$events | Format-Table
$events | Export-CSV $eventCsv
Write-Host "Logs saved to $($PWD)\$($eventCsv)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment