身安不如心安,屋宽不如心宽 。

[求助] filebeat7.4监控多文件输出至ES不同index和pipeline

Beats | 作者 nothing | 发布于2019年10月16日 | 阅读数:6128

需求: 
filebeat.inputs:
    1.mysql.error.log
    2.mysql.slow.log
    3.myjavalog(已将springboot日志输出到某文件)
output:
   直接output至ES,但是不同的文件来源需要对应不同的index和pipeline
 
版本: filebeat:7.4.0  ES:7.4.0
 
提问前努力: 翻过文档,翻阅了社区内前几页问题,做了demo发现ES里并没有数据
 
个人demo版本
filebeat.inputs:
- type: log
enabled: true
paths:
- /usr/local/mysql/data/localhost.localdomain.err*
fields:
index: "mysql_error"
- type: log
enabled: true
paths:
- /usr/local/mysql/data/localhost-slow.log*
fields:
index: "mysql_slow"
- type: log
enabled: true
paths:
- /usr/local/java/log/iot.log*
fields:
index: "mysql_slow"


filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: true

setup.template.settings:
index.number_of_shards: 1

output.elasticsearch:
hosts: ["10.11.40.229:9200"]
indices:
- index: "mysql-error-%{+yyyy.MM.dd}"
pipeline: "mysql_error_pipeline"
when.equals:
fields.index: "mysql_error"
- index: "mysql-slow-%{+yyyy.MM.dd}"
pipeline: "mysql_slow_pipeline"
when.equals:
fields.index: "mysql_slow"
- index: "iot-%{+yyyy.MM.dd}"
pipeline: "java_pipeline"
when.equals:
fields.index: "iot"


已邀请:

eraser

赞同来自: 2482118722ysj

你好:
output.elasticsearch:
  hosts: ["10.11.40.229:9200"]
  pipelines:
    - pipeline: "mysql_error_pipeline"
      when.equals:
        fields.index: "mysql_error"
  indices:
    - index: "mysql-error-%{+yyyy.MM.dd}"
      when.equals:
        fields.index: "mysql_error"
 
你可以试试这样写。 

Captain_Li

赞同来自:

我的解决了  可以看看这个博客 https://www.cnblogs.com/lemon-le/p/11932813.html 

Florence - 待我光头之日

赞同来自:

请问解决了吗

sweetguy

赞同来自:

老哥问题可解决了,分享一下吧

要回复问题请先登录注册