【发布时间】:2021-11-17 13:28:56
【问题描述】:
请求您的帮助。
我们正在使用 AKS 集群并希望在弹性搜索中提取自定义应用程序日志。 Fluentd 部署、Elastic Search 和 Kibana 的所有设置都在 aks 上完成并且正在运行。我们已经在 pod 中挂载了 azure 文件共享,并且应用程序已经开始放置自定义应用程序日志。下面是 Fluentd 文件的配置。现在的问题是,对于每个日志,我们都得到了由节点倍增的记录。例如,如果 AKS 集群有 10 个节点,那么相同的日志会被提取 10 次到弹性搜索中,并在 Kibana 中显示 10 次。
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentd-config
namespace: efk-cloud
data:
fluent.conf: |-
@include kubernetes.conf
#@include file.conf
#Just an example of what kind of variables can come inside. This part does not apply as config. Do your config with ENV vars
<match **>
@type elasticsearch
@id out_es
@log_level info
include_tag_key true
host "#{ENV['FLUENT_ELASTICSEARCH_HOST']}"
port "#{ENV['FLUENT_ELASTICSEARCH_PORT']}"
user "#{ENV['FLUENT_ELASTICSEARCH_USER']}"
scheme "#{ENV['FLUENT_ELASTICSEARCH_SCHEME'] || 'https'}"
password "#{ENV['FLUENT_ELASTICSEARCH_PASSWORD']}"
index_name efk-cloud-02
type_name fluentd
</match>
kubernetes.conf: |-
<match fluent.**>
@type null
</match>
<source>
@type tail
@id in_tail_containers_logs
path /var/log/customlog/*.log
pos_file /var/log/fluentd-containers.log.pos
tag kubernetes.*
read_from_head true
format json
time_format %Y-%m-%dT%H:%M:%S.%NZ
</source>
【问题讨论】:
标签: fluentd