On this page
win_eventlog_entry - Write entries to Windows event logs
New in version 2.4.
Synopsis
- Write log entries to a given event log from a specified source.
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| category | 
        
        A numeric task category associated with the category message file for the log source.
         | 
     |
| entry_type | 
       
  | 
      
        
        Indicates the entry being written to the log is of a specific type.
         | 
     
| event_id  
        required
         | 
      
        
        The numeric event identifier for the entry.
        
       
        Value must be between 0 and 65535.
         | 
     |
| log  
        required
         | 
      
        
        Name of the event log to write an entry to.
         | 
     |
| message  
        required
         | 
      
        
        The message for the given log entry.
         | 
     |
| raw_data | 
        
        Binary data associated with the log entry.
        
       
        Value must be a comma-separated array of 8-bit unsigned integers (0 to 255).
         | 
     |
| source  
        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.
 
Examples
- name: Write an entry to a Windows event log
  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
  win_eventlog_entry:
    log: AnotherLog
    source: MyAppSource
    event_id: 5000
    message: An error has occurred.
    entry_type: Error
    category: 5
    raw_data: 10,20
  Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Andrew Saraceni (@andrewsaraceni)
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.6/modules/win_eventlog_entry_module.html