You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/templates/filebeat/config/filebeat.yml.j2

75 lines
1.9 KiB
Django/Jinja

#jinja2: lstrip_blocks: "True"
# https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-reference-yml.html
filebeat.modules:
- module: system
syslog:
enabled: true
auth:
enabled: true
{% if filebeat_postgres_enabled | default(false) -%}
- module: postgresql
log:
enabled: true
{% endif -%}
{% if filebeat_maria_enabled | default(false) -%}
- module: mysql
error:
enabled: true
slowlog:
enabled: true
{% endif -%}
filebeat.inputs:
{% if filebeat_inputs is defined %}
{% for elem in filebeat_inputs %}
- type: {{ elem.type }}
paths:
{% for path in elem.paths %}
- {{ path }}
{% endfor %}
{%+ if elem.fields is defined -%}
fields:
{% for field in elem.fields %}
{{ field }}: {{ elem.fields[field] }}
{% endfor %}
{% endif %}
{% endfor %}
{% else %}
- type: container
paths:
- /var/lib/docker/containers/*/*.log
{% endif %}
{% if ansible_fqdn not in groups['harbor'] -%}
filebeat.autodiscover:
providers:
- type: docker
hints.enabled: true
templates:
- condition:
contains:
docker.container.image: smardigo
config:
- type: container
paths:
- /var/lib/docker/containers/${data.docker.container.id}/*.log
multiline.pattern: '^{|^[0-9]{4}-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after
{% endif %}
fields:
stage: {{ stage }}
hostname: {{ inventory_hostname }}
output.logstash:
hosts: ["{{ shared_service_elastic_stack_logstash_01_hostname }}:5044"]
ssl:
certificate_authorities:
- /usr/share/filebeat/config/certificates/ca/ca.crt
certificate: /usr/share/filebeat/config/certificates/{{ filebeat_certificate }}/{{ filebeat_certificate }}.crt
key: /usr/share/filebeat/config/certificates/{{ filebeat_certificate }}/{{ filebeat_certificate }}.key