Last active
November 9, 2018 17:06
-
-
Save joe-scalise/76f52b3ec0f62a780df85416e6b0dac2 to your computer and use it in GitHub Desktop.
Example on How to Tail the Windows Event Log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $latest = (get-eventlog -LogName 'Application' -Source 'docker' -Newest 1).Index | |
| while ($true) | |
| { | |
| Start-Sleep -m 5000 | |
| $tail = (get-eventlog -LogName 'Application' -Source 'docker' -Newest 1).Index | |
| [int]$grab = $tail - $latest | |
| if ($grab -gt 0) { | |
| get-eventlog -LogName 'Application' -Source 'docker' -newest $grab | sort index | select Index, TimeGenerated, Message | |
| $latest = $tail | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment