gpt4 book ai didi

elasticsearch - Fluentd Elasticsearch 目标索引

转载 作者:行者123 更新时间:2023-11-29 02:50:05 25 4
gpt4 key购买 nike

我正在使用 Fluentd将数据传输到 Elasticsearch。

td-agent.conf

## ElasticSearch
<match es.**>
type elasticsearch
target_index_key @target_index
logstash_format true
flush_interval 5s
</match>

Elasticsearch 索引:

"logstash-2016.02.24" : {
"aliases" : { },
"mappings" : {
"fluentd" : {
"dynamic" : "strict",
"properties" : {
"@timestamp" : {
"type" : "date",
"format" : "strict_date_optional_time||epoch_millis"
},
"dummy" : {
"type" : "string"
}

}
}
},

传输json数据:

$ curl -X POST -d 'json={"@target_index": "logstash-2016.02.24","dummy":"test"}' http://localhost:8888/es.test

它应该将数据写入给定的索引而不是它创建新索引 - logstash-2016.02.25 并将数据写入其中。我想将数据写入给定的索引。

这是 Fluentd elasticsearch github 链接: https://github.com/uken/fluent-plugin-elasticsearch

如果我遗漏了什么,请纠正我。

最佳答案

也许这是旧的但实际上我遇到了同样的问题并解决了

logstash_format false
index_name fluentd

这只会创建 fluentd 作为索引。来自fluentd官方教程https://docs.fluentd.org/output/elasticsearch

logstash_format(可选):此选项设置为 true 时,Fluentd 使用常规索引名称格式 logstash-%Y.%m.%d(默认值:false) .此选项取代 index_name 选项。

要清理旧索引,请考虑使用 Curator:https://github.com/elastic/curator

希望对大家有帮助。

关于elasticsearch - Fluentd Elasticsearch 目标索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35627870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com