Announcement

Collapse
No announcement yet.

Collect last 5 Critical Windows Event Logs ( Python )

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Collect last 5 Critical Windows Event Logs ( Python )

    You can collect the last 5 critical Windows Event Logs with below script:
    import os;
    print("5 recent critical logs in all category")
    syslogs=os.popen('wevtutil qe System "/q:*[System [(Level=1)]]" /f:text /c:5 /rd:True').read()
    print(syslogs);
    applogs=os.popen('wevtutil qe Application "/q:*[Application [(Level=1)]]" /f:text /c:5 /rd:True').read()
    print(applogs);
    seclogs=os.popen('wevtutil qe Security "/q:*[Security [(Level=1)]]" /f:text /c:5 /rd:True').read()
    print(seclogs);
    setlogs=os.popen('wevtutil qe Setup "/q:*[Setup [(Level=1)]]" /f:text /c:5 /rd:True').read()
    print(setlogs);
    forlogs=os.popen('wevtutil qe ForwardedEvents "/q:*[ForwardedEvents [(Level=1)]]" /f:text /c:5 /rd:True').read()
    print(forlogs);


    Example output would be:

    Click image for larger version

Name:	Critical event logs.png
Views:	1
Size:	30.6 KB
ID:	4435


Working...
X