k8sConfigs/efk/fluentd-configMap2.yaml

79 lines
1.7 KiB
YAML
Raw Normal View History

2025-03-09 09:44:53 +08:00
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentd-config
namespace: efk
data:
fluent.conf: |
<source>
@type http
@id input_http
port 8888
@label @main
</source>
<label @main>
2025-03-10 11:20:33 +08:00
<match sardine.log.**>
2025-03-09 09:44:53 +08:00
@type copy
<store>
@type elasticsearch
2025-03-10 11:20:33 +08:00
@id output_elasticsearch
2025-03-09 09:44:53 +08:00
host elasticsearch
port 9200
scheme http
user fluentd_user
password fluentd_password
2025-03-10 11:20:33 +08:00
logstash_format true
logstash_prefix logstash
logstash_dateformat %Y.%m.%d
2025-03-09 09:44:53 +08:00
flush_interval 5s
@log_level debug
2025-03-10 11:20:33 +08:00
id_key _id
remove_keys _id
</store>
<store>
@type stdout
@id output_stdout
2025-03-09 09:44:53 +08:00
</store>
2025-03-10 11:20:33 +08:00
</match>
<match tanya.**>
@type rewrite_tag_filter
@id rewrite_tag_for_tanya
<rule>
key @log_name
pattern ^tanya\.candle\.([^\.]+)\.([^\.]+)\.([^\.]+)$
tag candle.$1.$2.$3
</rule>
</match>
<match candle.**>
@type copy
2025-03-09 09:44:53 +08:00
<store>
@type elasticsearch
2025-03-10 11:20:33 +08:00
@id output_elasticsearch_tanya
2025-03-09 09:44:53 +08:00
host elasticsearch
port 9200
scheme http
user fluentd_user
password fluentd_password
2025-03-10 11:20:33 +08:00
index_name candle_${tag_parts[1]}_${tag_parts[2]}_${tag_parts[3]}
2025-03-09 09:44:53 +08:00
flush_interval 5s
@log_level debug
2025-03-10 11:20:33 +08:00
id_key _id
2025-03-09 09:44:53 +08:00
remove_keys _id
2025-03-10 11:20:33 +08:00
include_tag_key true
tag_key @log_name
2025-03-09 09:44:53 +08:00
</store>
<store>
@type stdout
2025-03-10 11:20:33 +08:00
@id output_stdout_tanya
2025-03-09 09:44:53 +08:00
</store>
</match>
</label>
<match **>
@type stdout
@id output_stdout_all
</match>