愚者求师之过,智者从师之长。

filebeat Template 报错

Beats | 作者 飘落的秋 | 发布于2018年01月17日 | 阅读数:12639

我用 filebeat 推送日志到 es,然后自己写了一个 module,可以正常解析日志。我在 filebeat.yml 里配置了两个 index
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]
index: "nginx-%{[beat.version]}-%{+yyyy.MM.dd}"
indices:
- index: "ro-%{[beat.version]}-%{+yyyy.MM.dd}"
when.contains:
source: "ro"
然后,我把对应的解析放到了 fields.yml 里面,并在filebeat.yml 配置了两个,我不知道 index 怎么跟
template 做匹配
setup.template.name: "nginx"
#setup.template.fields: "${path.config}/fields.yml"
setup.template.overwrite: false
setup.template.pattern: "nginx-*"

setup.template.name: "ro"
setup.template.pattern: "ro*"

这样启动以后,日志可以正常推送,也能看到两个 index,但是 ro 的日志字段跟我写类型不符,全是 string。另外日志会报错
2018-01-17T17:02:34+08:00 INFO Connected to Elasticsearch version 6.1.1
2018-01-17T17:02:34+08:00 INFO Template already exists and will not be overwritten.
2018-01-17T17:02:35+08:00 ERR Failed to publish events: temporary bulk send failure
求各位看看是什么问题
已邀请:

rockybean - Elastic Certified Engineer, ElasticStack Fans,公众号:ElasticTalk

赞同来自:

应该是只能写一个 template,你可以自己手动去把 template 建好,毕竟是一次性的工作,不一定非得让 filebeat做这件事情

要回复问题请先登录注册