Skip to content

Instantly share code, notes, and snippets.

@luthermonson
Last active September 11, 2020 22:31
Show Gist options
  • Save luthermonson/08589cc189690870ac2df594d57d2236 to your computer and use it in GitHub Desktop.
Save luthermonson/08589cc189690870ac2df594d57d2236 to your computer and use it in GitHub Desktop.
Powershell to Tail Docker Logs
# Make sure you setup c:\ProgramData\docker\config\daemon.json to contain log-level: debug and debug: true
$idx = (Get-EventLog -LogName Application -Source Docker -Newest 1).Index
while ($True)
{
Start-Sleep -MilliSeconds 100
$idx2 = (Get-EventLog -LogName Application -Source Docker -Newest 1).index
if (-NOT($idx -eq $idx2)) {
Get-EventLog -logname Application -Source Docker -Newest ($idx2 - $idx) | Sort index | Select-Object Message
}
$idx = $idx2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment