Nim*_*it 5 elasticsearch fluentd kibana
我正在使用Fluentd将数据传输到Elasticsearch中。
td-agent.conf
## ElasticSearch
<match es.**>
type elasticsearch
target_index_key @target_index
logstash_format true
flush_interval 5s
</match>
Run Code Online (Sandbox Code Playgroud)
Elasticsearch索引:
"logstash-2016.02.24" : {
"aliases" : { },
"mappings" : {
"fluentd" : {
"dynamic" : "strict",
"properties" : {
"@timestamp" : {
"type" : "date",
"format" : "strict_date_optional_time||epoch_millis"
},
"dummy" : {
"type" : "string"
}
}
}
},
Run Code Online (Sandbox Code Playgroud)
传输json数据:
$ curl -X POST -d 'json={"@target_index": "logstash-2016.02.24","dummy":"test"}' http://localhost:8888/es.test
Run Code Online (Sandbox Code Playgroud)
它应该将数据写入给定索引而不是给定索引。它将创建新索引-logstash-2016.02.25,它将数据写入该索引。我想将数据写入给定的索引。
这是Fluentd elasticsearch github链接:https : //github.com/uken/fluent-plugin-elasticsearch
如果我缺少某些东西,请纠正我。
小智 5
也许这已经很旧了,但实际上我遇到了同样的问题并解决了
logstash_format false
index_name fluentd
Run Code Online (Sandbox Code Playgroud)
这仅创建fluentd
为索引。来自官方 Fluentd 教程https://docs.fluenced.org/output/elasticsearch
logstash_format
(可选):将此选项设置为 true 时,Fluentd 将使用常规索引名称格式logstash-%Y.%m.%d
(默认值: false)。该选项取代该index_name
选项。
要清理旧索引,请考虑使用 Curator: https: //github.com/elastic/curator
我希望它能帮助某人。
试试这个,由于logstash_format true,请在下面的index_name字段中输入您的索引名称(默认值为fluidd)
<match es.**>
@type elasticsearch
host localhost
port 9200
index_name <.....your_index_name_here.....>
type_name fluentd
flush_interval 5s
</match>
Run Code Online (Sandbox Code Playgroud)
运行此命令后,请通过在浏览器中加载以下网址来检查是否创建了索引
http://localhost:9200/_plugin/head/
祝你好运
归档时间: |
|
查看次数: |
6660 次 |
最近记录: |