0

How can get log from this path : Application and service -> microsoft ->windows -> ...

like This Eventlog path

I wrote this code but it did not work for this path I also get the logtype ... from in eventlog

    server = 'localhost' # name of the target computer to get event logs
    logtype = "Microsoft-Windows-Dhcp-Client/Admin" # 'Application' # 'Security' #'System'
    hand = we.OpenEventLog(None,logtype)
    flags = we.EVENTLOG_FORWARDS_READ|we.EVENTLOG_SEQUENTIAL_READ
    while True:
            events = we.ReadEventLog(hand, flags,0)
            if events:
                for event in events:
                   Source_Name  = event.SourceName
Lashgari
  • 41
  • 11
  • I used evtx library, if there is another method, thank you for your help. – Lashgari Jan 31 '21 at 05:04
  • This question has been answered in https://stackoverflow.com/questions/62173180/open-specific-event-logs-using-win32evtlog-python Shortly it says that you need to read log in XML format and parse them. – kemalbastak Jun 17 '21 at 13:26
  • @kaco I also used the method you mentioned and it had problems, including when there are too many logs **EvtNext** can not support well and I solved my problem with **evtx.Evtx**. – Lashgari Jun 19 '21 at 06:54

0 Answers0