community.general.logstash callback – Sends events to Logstash
Note
This callback plugin is part of the community.general collection (version 10.7.5).
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.general.
You need further requirements to be able to use this callback plugin,
see Requirements for details.
To use it in a playbook, specify: community.general.logstash.
Callback plugin
This plugin is a notification callback. It sends information for a playbook run to other applications, services, or systems. See Callback plugins for more information on callback plugins.
Synopsis
- This callback will report facts and task events to Logstash https://www.elastic.co/products/logstash. 
Requirements
The below requirements are needed on the local controller node that executes this callback.
- whitelisting in configuration 
- logstash (Python library) 
Parameters
| Parameter | Comments | 
|---|---|
| Logging format. Choices: 
 Configuration: 
 | |
| Port on which logstash is listening. Default:  Configuration: 
 | |
| Executes command before run and its result is added to the  Configuration: 
 | |
| Address of the Logstash server. Default:  Configuration: 
 | |
| Message type. Default:  Configuration: 
 | 
Note
Configuration entries listed above for each entry type (Ansible variable, environment variable, and so on) have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. The entry types are also ordered by precedence from low to high priority order. For example, an ansible.cfg entry (further up in the list) is overwritten by an Ansible variable (further down in the list).
Examples
ansible.cfg: |
  # Enable Callback plugin
  [defaults]
      callback_whitelist = community.general.logstash
  [callback_logstash]
      server = logstash.example.com
      port = 5000
      pre_command = git rev-parse HEAD
      type = ansible
11-input-tcp.conf: |-
  # Enable Logstash TCP Input
  input {
          tcp {
              port => 5000
              codec => json
              add_field => { "[@metadata][beat]" => "notify" }
              add_field => { "[@metadata][type]" => "ansible" }
          }
      }
