任何指针赞赏 . 谢谢 .
Background :
使用Fluentd logging driver将Docker日志发送到ElasticSearch .
Problem :
让Fluentd根据给容器的标签使用动态索引名称 . 标签的格式为:airline.country.region.city .
因此,目标是使用标签“airline”中的第一个字符串作为索引名称 . 所以它将是“航空公司 - %Y%m%d” .
Possible solutions
Dynamic Configuration - 这是一个实验性功能,具有一定的安全性和性能影响 .
Forest Plugin - 不再支持 . 建议使用Fluentd本机API来处理标记 .
Placeholders - 我认为这只支持使用整个标记 .
Current config
<match *.**>
@type copy
<store>
@type elasticsearch
host elasticsearch
port 9200
logstash_format true
logstash_prefix fluentd
logstash_dateformat %Y%m%d
include_tag_key true
type_name access_log
tag_key @log_name
flush_interval 1s
</store>
<store>
@type stdout
</store>
</match>