Reading Eventlogs

From IronPython Cookbook

You can use the System.Diagnostics library to access eventlogs from machines. It is surprisingly easy.


import System,clr
import System.Diagnostics.EventLog

for log in System.Diagnostics.EventLog.GetEventLogs('server'):
    for entry in log.Entries:
        print log.Log,entry.Message


Back to Contents.

TOOLBOX
LANGUAGES