k8sConfigs/efk_cluster/fluentd-configMap.yaml
2025-03-24 22:35:32 +08:00

90 lines
2.2 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: fluentd-config
namespace: efk
data:
fluent.conf: |
<source>
@type http
@id input_http
port 8888
tag sardine.log
@label @main
</source>
<label @main>
<match sardine.log.**>
@type rewrite_tag_filter
<rule>
key @timestamp
pattern /^(202[4-9]|2[1-9]\d{3})/
tag hot.${tag}
</rule>
<rule>
key @timestamp
pattern /^(202[0-3])/
tag warm.${tag}
</rule>
<rule>
key @timestamp
pattern /^(201\d|200\d|19\d{2})/
tag cold.${tag}
</rule>
</match>
<match hot.sardine.log.**>
@type elasticsearch
@id output_elasticsearch_hot
hosts elasticsearch-0.elasticsearch-service.efk.svc.cluster.local:9200
scheme http
user fluentd_user
password fluentd_password
logstash_format true
logstash_prefix logstash
index_date_pattern now/d
include_tag_key true
tag_key @log_name
flush_interval 5s
@log_level debug
</match>
<match warm.sardine.log.**>
@type elasticsearch
@id output_elasticsearch_warm
hosts elasticsearch-1.elasticsearch-service.efk.svc.cluster.local:9200
scheme http
user fluentd_user
password fluentd_password
logstash_format true
logstash_prefix logstash
index_date_pattern now/d
include_tag_key true
tag_key @log_name
flush_interval 10s
@log_level debug
</match>
<match cold.sardine.log.**>
@type elasticsearch
@id output_elasticsearch_cold
hosts elasticsearch-2.elasticsearch-service.efk.svc.cluster.local:9200
scheme http
user fluentd_user
password fluentd_password
logstash_format true
logstash_prefix logstash
index_date_pattern now/d
include_tag_key true
tag_key @log_name
flush_interval 30s
@log_level debug
</match>
</label>
<match **>
@type stdout
@id output_stdout_all
</match>