Skip to content
Snippets Groups Projects
Commit b7ebc128 authored by jurgenhaas's avatar jurgenhaas
Browse files

Documentation

parent 0b5f93f4
Branches
Tags
No related merge requests found
# Ansible FluentD Callback Plugin
This repository provides a callback plugin that ships Ansible output via FluentD to an indexer as configured via FLuentD.
### Ansible section
Install fluent-logger
```
pip install fluent-logger
```
Append the following to the `[defaults]` section of your `ansible.cfg`
```
callback_plugins = <path_to_callback_plugins_folder>
callback_whitelist = fluentd
```
Put the `fluentd` plugin from this git repository into the path_to_callback_plugins_folder as defined above.
This plugin makes use of the following environment variables:
* `FLUENTD_SERVER` (optional): defaults to localhost
* `FLUENTD_PORT` (optional): defaults to 24224
* `FLUENTD_TYPE` (optional): defaults to ansible
### FluentD section
Basic fluentd testing config
```
<source>
type forward
port 24224
</source>
```
Shipping logs to elasticsearch
```
<source>
@type forward
port 24224
</source>
<match app.ansible>
@type elasticsearch
logstash_format true
host 127.0.0.1
port 9200
include_tag_key true
tag_key @log_name
index_name ansible
type_name ansible
reconnect_on_error true
</match>
```
### Elasticsearch
This repository contains a file titled `ansible.json`. This template can be loaded into your elasticsearch cluster to provide a nice mapping for the ansible data.
List available templates
```
curl -s -XGET localhost:9200/_template
```
Load the template
```
curl -s -XPUT 'http://localhost:9200/_template/ansible' -d@ansible.json
```
{
"mappings": {
"_default_": {
"_all": {
"norms": false
},
"dynamic_templates": [
{
"strings_as_keyword": {
"mapping": {
"ignore_above": 1024,
"type": "keyword"
},
"match_mapping_type": "string"
}
}
],
"properties": {
"@timestamp": {
"type": "date"
},
"input_type": {
"ignore_above": 1024,
"type": "keyword"
},
"message": {
"norms": false,
"type": "text"
},
"ansible_result": {
"norms": false,
"type": "text"
},
"ansible_facts": {
"norms": false,
"type": "text"
},
"tags": {
"ignore_above": 1024,
"type": "keyword"
},
"type": {
"ignore_above": 1024,
"type": "keyword"
}
}
}
},
"order": 0,
"template": "ansible-*"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment