Control the number of error application in Event Viewer with Python

19 views Asked by At

With Python I need to find the total number of application errors in the event log. application error

With this code I find the number of all application Event Viewer logs.

import win32evtlog
import win32event
import win32api

server = 'localhost' # name of the target computer to get event logs
logtype = 'Application'
hand = win32evtlog.OpenEventLog(server, logtype)
flags = win32evtlog.EVENTLOG_FORWARDS_READ | win32evtlog.EVENTLOG_SEQUENTIAL_READ
total = win32evtlog.GetNumberOfEventLogRecords(hand)
print(total)

How can it be filtered?

0

There are 0 answers