gpt4 book ai didi

elasticsearch - 将id_key与fluentd/elasticsearch结合使用

转载 作者:行者123 更新时间:2023-12-03 02:03:52 25 4
gpt4 key购买 nike

我最近开始尝试使用fluentd + elasticsearch + kibana设置。
我目前正在流利地提供信息,方法是读取我正在用python代码吐出来的日志文件。
该日志由json数据列表构成,每行一个,如下所示:

{"id": "1","date": "2014-02-01T09:09:59.000+09:00","protocol": "tcp","source ip": "xxxx.xxxx.xxxx.xxxx","source port": "37605","country": "CN","organization": "China Telecom jiangsu","dest ip": "xxxx.xxxx.xxxx.xxxx","dest port": "23"}

按照 here的说明,我可以进行流利的设置来读取我的字段“id”并填写“_id”:
<source>
type tail
path /home/(usr)/bin1/fluentd.log
tag es
format json
keys id, date, prot, srcip, srcport, country, org, dstip, dstport
id_key id
time_key date
time_format %Y-%m-%dT%H:%M:%S.%L%:z
</source>

<match es.**>
type elasticsearch
logstash_format true
flush_interval 10s # for testing
</match>

但是,插入上述内容后的“_id”仍然是随机生成的_id。
如果有人可以向我指出我在做什么错,我将不胜感激。

最佳答案

id_key id应该在<match es.**>内部,而不是<source>中。
<source>用于输入插件,在这种情况下为tail。<match>用于输出插件,在这种情况下为elasticsearch。
因此应在<match>中设置elasticsearch配置。

http://docs.fluentd.org/articles/config-file

关于elasticsearch - 将id_key与fluentd/elasticsearch结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28736329/

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