Hongli Bu
Hongli Bu

Reputation: 561

How to report event to Windows System log in python

I am now trying to report event log to windows, right now I am using win32evtlogutil


        win32evtlogutil.ReportEvent(
            app_name, app_event_id,
            eventCategory=app_event_category,
            eventType=event_type,
            strings=[str(message)], data=app_event_data
        )

but this only report event log to application log? but how can I report the event to security log(see picture below)?

enter image description here

Upvotes: 0

Views: 775

Answers (1)

Mike Clark
Mike Clark

Reputation: 10136

As of Windows XP SP2+ ReportEvent() cannot be used to report security events. You must use the Windows API AuthzReportSecurityEvent() function. PyWin32 does not have a convenience binding for this function, so you would need to write the binding yourself.

Upvotes: 2

Related Questions