11. [pywin32] ClearEventLog() 함수
pywin32/win32evtlog2020. 7. 25. 13:47
ClearEventLog(handle, eventLogName)
이벤트 로그의 내용을 모두 지우는 함수입니다. 지울때 백업을 할 지 정할 수 있습니다.
인자로는 handle : int, eventLogName : PyUnicode 가 있습니다.
handle은 클리어할 이벤트 로그의 핸들로 OpenEventLog 함수의 리턴값입니다.
eventLogName은 이벤트 로그를 지우기전에 백업할 경우 작성하는 곳입니다.
BackupEventLog 함수의 eventLogName 인자와 사용법이 같습니다.(BackupEventLog 함수 참조)
만약, 백업을 하지 않겠다면 None으로 설정하시면 됩니다.
import win32evtlog
pHandle = win32evtlog.OpenEventLog(None, "Application")
win32evtlog.ClearEventLog(pHandle, "C:\\test\BackupEventTestFile.evtx")
# 백업하고 clear
win32evtlog.ClearEventLog(pHandle, None)
# 그냥 clear
win32evtlog.CloseEventLog(pHandle)
위 코드의 실행 결과 test폴더에 백업 파일이 생기고 이벤트로그가 다 지워졌습니다.
반응형
'pywin32 > win32evtlog' 카테고리의 다른 글
13. [pywin32] NotifyChangeEventLog() 함수 (0) | 2020.07.25 |
---|---|
12. [pywin32] OpenBackupEventLog() 함수 (0) | 2020.07.25 |
10. [pywin32] BackupEventLog() 함수 (0) | 2020.07.25 |
9. [pywin32] ReadEventLog() 함수 (0) | 2020.07.25 |
8. [pywin32] GetOldestEventLogRecord() 함수 (0) | 2020.07.24 |
댓글()