add fluentd service

This commit is contained in:
Pim Kunis 2023-08-02 18:07:24 +02:00
parent 3c4f505413
commit 1a745bfa22
4 changed files with 39 additions and 1 deletions

View file

@ -9,6 +9,9 @@ configs:
esdatasource:
external: true
name: "{{ esdatasource.config_name }}"
fluentconf:
external: true
name: "{{ fluentconf.config_name }}"
volumes:
escerts:
@ -96,3 +99,11 @@ services:
configs:
- source: esdatasource
target: /etc/grafana/provisioning/datasources/elasticsearch.yaml
fluentd:
image: git.kun.is/pim/fluentd:1.0.1
ports:
- 24224:24224
configs:
- source: fluentconf
target: /fluentd/etc/fluent.conf

View file

@ -1,3 +1,4 @@
# vi: ft=yaml
apiVersion: 1
datasources:

View file

@ -0,0 +1,18 @@
# vi: ft=yaml
# Receive events from 24224/tcp
# This is used by log forwarding and the fluent-cat command
<source>
@type forward
port 24224
</source>
<match cool.testje>
@type elasticsearch
host maestro.dmz
port {{ elasticsearch_port }}
include_timestamp true
</match>
<system>
log_level info
</system>

View file

@ -1,7 +1,15 @@
- name: Create fluentd config
docker_config:
name: fluentconf
data: "{{ lookup('template', '{{ role_path }}/fluent.conf.j2') }}"
use_ssh_client: true
rolling_versions: true
register: fluentconf
- name: Create elasticsearch data source config
docker_config:
name: esdatasource
data: "{{ lookup('template', '{{ role_path }}/elasticsearch.yml') }}"
data: "{{ lookup('template', '{{ role_path }}/elasticsearch.yml.j2') }}"
use_ssh_client: true
rolling_versions: true
register: esdatasource