Collect 5 Most Recent Windows Event Logs In System Category ( Python )

You can collect the 5 most recent Windows Event logs in system category with below script:

import os;
syslogs=os.popen(‘wevtutil qe System “/q:*[System [(Level=2)]]” /f:text /c:5 /rd:True’).read()
print(syslogs);

Example output would be: