需求: 
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:
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"

 
	
4 个回复
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
赞同来自:
Florence - 待我光头之日
赞同来自:
sweetguy
赞同来自: