1

pywin32 を使用して Windows イベント ログを読み取る例を読みました。

イベントログに対する Python の win32 アクセス


Windowsイベントログが到着したら(ログが他のアプリケーションによって設定された可能性があります)、python関数(私のコード)を起動して、イベントをリアルタイムで監視できるようにします。

私は一日中それをグールし、良い解決策を見つけることができません. それは私のテストコードです:

import win32evtlog
import win32event

def function_wait():
    #i check the new windows log is set , but this function wasn't fired
    print 'a new event log.' 

file_open_hand = win32evtlog.OpenEventLog('my-pc','Application')
# i thought it's definitly wrong below, but i have no idear about the 4th parameter!
hEvent = win32event.CreateEvent (None, 1, 0, 'function_wait') 

win32evtlog.NotifyChangeEventLog(file_open_hand,hEvent)

inputx = raw_input("wait for event log fire...")
4

0 に答える 0