filebeat5与filebeat6配置index的差异

    filebeat6配置index需要添加setup对应项,不然启动会报错。

6.0以后版本具体设置在filebeat.yml如下:

setup.template.name: "myname-01"        #顶格,和output对其

setup.template.pattern: "myname-01-*"   #顶格,和output对其

output.elasticsearch:

  hosts: ["192.168.10.63:9200"]

  index: "myname-01-%{+yyyy.MM.dd}"     #和hosts对其

 

ES6 不再支持自己在同一个index下定义多个type. 因此 以前 filebeat中的 document_type 配置不再生效。
同时,由于 filebeat的 output.elasticsearch中的index配置并不能具体到 prospector 之中,所以一份配置文件只能共用一个index.
 
如果我有两个日志文件 info.log err.log 
 
我需要写入到同一个es集群中的 log_info 、log_err 两个 index中,该如何配置?
 
文档给出了一个基于日志内容字段匹配的方案:

output.elasticsearch:
  hosts: ["http://localhost:9200"]
  index: "logs-%{[beat.version]}-%{+yyyy.MM.dd}"
  indices:
    - index: "critical-%{[beat.version]}-%{+yyyy.MM.dd}"
      when.contains:
        message: "CRITICAL"
    - index: "error-%{[beat.version]}-%{+yyyy.MM.dd}"
      when.contains:
        message: "ERR"

 

但是有一个问题是,如果这两个日志文件无法通过特定的字段来区分,该如何实现将两个文件的内容分别插入到不同的index中?
 
有一个临时方案是,分别启动两个 fiilebeat 实例,通过 --path.config 指定不同的配置文件,两个配置文件中配置不同的 index。
 
在 filebeat 支持 每个prospector 可以配置独立的 index之前,有没有其他比较好的方案?

备注:

kibana 汉化包地址:

https://github.com/anbai-inc/Kibana_Hanization

X-packed 相关地址:

https://blog.csdn.net/qq_25475209/article/details/81906701

一个很好的ELK XPACKED使用地址:

https://www.plaza4me.com/article/20180825222918266

直接导入license方法的地址:

https://blog.csdn.net/sun_duoLong/article/details/82182596

posted @ 2018-09-18 15:33  gnix  阅读(1991)  评论(0编辑  收藏  举报