community.windows.win_eventlog_entry (2.2.0) — module

Write entries to Windows event logs

Authors: Andrew Saraceni (@andrewsaraceni)

Install collection

Install with ansible-galaxy collection install community.windows:==2.2.0


Add to requirements.yml

  collections:
    - name: community.windows
      version: 2.2.0

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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.
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
log:
    description:
    - Name of the event log to write an entry to.
    required: true
    type: str

source:
    description:
    - Name of the log source to indicate where the entry is from.
    required: true
    type: str

message:
    description:
    - The message for the given log entry.
    required: true
    type: str

category:
    description:
    - A numeric task category associated with the category message file for the log source.
    type: int

event_id:
    description:
    - The numeric event identifier for the entry.
    - Value must be between 0 and 65535.
    required: true
    type: int

raw_data:
    description:
    - Binary data associated with the log entry.
    - Value must be a comma-separated array of 8-bit unsigned integers (0 to 255).
    type: str

entry_type:
    choices:
    - Error
    - FailureAudit
    - Information
    - SuccessAudit
    - Warning
    description:
    - Indicates the entry being written to the log is of a specific type.
    type: str

See also