Commit 5ecc8968 authored by Jürgen Haas's avatar Jürgen Haas

Fully install and configure Fluentd aggregator/receiver

parent 14c0a902
fluentd_cert_passphrase: ''
---
dependencies:
- { role: fluentd-client }
- { role: kibana }
# fluentd
# http://www.fluentd.org
# Prepare: http://docs.fluentd.org/articles/before-install
# curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sh
#
# UI: http://docs.fluentd.org/articles/fluentd-ui
# Plugins
# fluent-plugin-elasticsearch
# fluent-plugin-record-reformer
#
# Tutorials
# https://sonnguyen.ws/centralize-docker-logs-with-fluentd-elasticsearch-and-kibana/
# https://sonnguyen.ws/monitor-nginx-response-time-with-fluentd-kibana-and-elasticsearch/
#
# Create SSL-Cert once upfront in the inventory and use the passührase similar to {{ fluentd_cert_passphrase }}:
# openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 90 -subj '/CN={{ fluentd_hostname }}'
---
# file: roles/fluentd/tasks/main.yml
- name: "Install Plugins"
command: td-agent-gem install {{ item }}
with_items:
- 'fluent-plugin-elasticsearch'
- 'fluent-plugin-record-reformer'
- name: "Copy SSL Key"
copy:
src='{{ inventory_dir }}/files/ssl/td-agent/key.pem'
dest='/etc/ssl/td-agent/key.pem'
owner='root'
group='root'
mode=644
<source>
@type secure_forward
shared_key {{ fluentd_shared_key }}
self_hostname {{ inventory_hostname }}
secure true
ca_cert_path /etc/ssl/td-agent/cert.pem
ca_private_key_path /etc/ssl/td-agent/key.pem
ca_private_key_passphrase {{ fluentd_cert_passphrase }}
authentication yes
<user>
username {{ fluentd_username }}
password {{ fluentd_password }}
</user>
</source>
<match **>
@type elasticsearch
logstash_format true
host 127.0.0.1
port 9200
index_name fluentd
type_name fluentd
</match>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment