Created
January 9, 2020 19:16
-
-
Save anup1384/3a3587097dac62a70637445b4af6b002 to your computer and use it in GitHub Desktop.
fluentd-config-map custome index
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/containers.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> | |
<match kubernetes.var.log.containers.**kube-logging**.log> | |
@type null | |
</match> | |
<match kubernetes.var.log.containers.**kube-system**.log> | |
@type null | |
</match> | |
<match kubernetes.var.log.containers.**monitoring**.log> | |
@type null | |
</match> | |
<match kubernetes.var.log.containers.**infra**.log> | |
@type null | |
</match> | |
# we send the logs to Elasticsearch | |
<match kubernetes.**> | |
@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 ${record['kubernetes']['pod_name']} | |
<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