Last active
November 10, 2021 13:39
fluentd-config-map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: fluentd-config | |
namespace: infra | |
data: | |
fluent.conf: | | |
<match fluent.**> | |
# this tells fluentd to not output its log on stdout | |
@type null | |
</match> | |
# here we read the logs from Docker's containers and parse them | |
<source> | |
@type tail | |
path /var/log/containers/*.log | |
pos_file /var/log/app.log.pos | |
tag kubernetes.* | |
read_from_head true | |
<parse> | |
@type json | |
time_format %Y-%m-%dT%H:%M:%S.%NZ | |
</parse> | |
</source> | |
# we use kubernetes metadata plugin to add metadatas to the log | |
<filter kubernetes.**> | |
@type kubernetes_metadata | |
</filter> | |
# we send the logs to Elasticsearch | |
<match **> | |
@type elasticsearch_dynamic | |
@log_level info | |
include_tag_key true | |
host "#{ENV['FLUENT_ELASTICSEARCH_HOST']}" | |
port "#{ENV['FLUENT_ELASTICSEARCH_PORT']}" | |
user "#{ENV['FLUENT_ELASTICSEARCH_USER']}" | |
password "#{ENV['FLUENT_ELASTICSEARCH_PASSWORD']}" | |
scheme "#{ENV['FLUENT_ELASTICSEARCH_SCHEME'] || 'http'}" | |
ssl_verify "#{ENV['FLUENT_ELASTICSEARCH_SSL_VERIFY'] || 'true'}" | |
reload_connections true | |
logstash_format true | |
logstash_prefix logstash | |
<buffer> | |
@type file | |
path /var/log/fluentd-buffers/kubernetes.system.buffer | |
flush_mode interval | |
retry_type exponential_backoff | |
flush_thread_count 2 | |
flush_interval 5s | |
retry_forever true | |
retry_max_interval 30 | |
chunk_limit_size 2M | |
queue_limit_length 32 | |
overflow_action block | |
</buffer> | |
</match> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment