You need to set up a WMI Temporary Event Consumer in your app. Note that to monitor the
Event Log you will need to request the SeSecurityPrivilege
in your WMI connection (as it's possible you could receive events from the Security log, which require this permission)
These are some example WQL queries:
// See all events:
select * from __InstanceCreationEvent where TargetInstance ISA 'Win32_NTLogEvent'
// Catch only specific events: 4202 is a network transport failure
select * from __InstanceCreationEvent where TargetInstance ISA 'Win32_NTLogEvent'
and TargetInstance.EventCode=4202
// Catch only events from a specific source: in this case WMI itself.
select * from __InstanceCreationEvent where TargetInstance ISA 'Win32_NTLogEvent'
and TargetInstance.SourceName='WinMgmt'