community.windows.win_eventlog_entry – Write entries to Windows event logs

Note

This plugin is part of the community.windows collection (version 1.9.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.windows.

To use it in a playbook, specify: community.windows.win_eventlog_entry.

Synopsis

  • Write log entries to a given event log from a specified source.

Parameters

Parameter Choices/Defaults Comments
category
integer
A numeric task category associated with the category message file for the log source.
entry_type
string
    Choices:
  • Error
  • FailureAudit
  • Information
  • SuccessAudit
  • Warning
Indicates the entry being written to the log is of a specific type.
event_id
integer / required
The numeric event identifier for the entry.
Value must be between 0 and 65535.
log
string / required
Name of the event log to write an entry to.
message
string / required
The message for the given log entry.
raw_data
string
Binary data associated with the log entry.
Value must be a comma-separated array of 8-bit unsigned integers (0 to 255).
source
string / required
Name of the log source to indicate where the entry is from.

Notes

Note

  • This module will always report a change when writing an event entry.

See Also

See also

community.windows.win_eventlog

The official documentation on the community.windows.win_eventlog module.

Examples

- name: Write an entry to a Windows event log
  community.windows.win_eventlog_entry:
    log: MyNewLog
    source: NewLogSource1
    event_id: 1234
    message: This is a test log entry.

- name: Write another entry to a different Windows event log
  community.windows.win_eventlog_entry:
    log: AnotherLog
    source: MyAppSource
    event_id: 5000
    message: An error has occurred.
    entry_type: Error
    category: 5
    raw_data: 10,20

Authors

  • Andrew Saraceni (@andrewsaraceni)