filebeat监控多个文件,并且分配到ES 不同的index

本文介绍了如何使用Filebeat配置来实现对多个日志文件的监控,并将不同文件的日志数据发送到Elasticsearch的不同索引中,同时支持JSON日志内容解析。
摘要由CSDN通过智能技术生成

filebeat.yml 全部配置如下,支持对日志内容的 json 进行解析,可直接使用。测试日志如{"host_ip":"127.0.0.1","res-time":"2019-11-03 17:17:32.715","create_time":"2019-11-03T17:17:32.715+0800","res-key":0,"uuid":"","business_id":"test-random"}

###################### Filebeat Configuration Example #########################

# This file is an example configuration file highlighting only the most common
# options. The filebeat.reference.yml file from the same directory contains all the
# supported options with more comments. You can use it as a reference.
#
# You can find the full configuration reference here:
# https://www.elastic.co/guide/en/beats/filebeat/index.html

# For more available modules and options, please see the filebeat.reference.yml sample
# configuration file.

#=========================== Filebeat inputs =============================

filebeat.inputs:

# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.

- type: log

  enabled: true
  paths:
      # - /home/elsearch/work/logs/*_filebeat.log
    - /home/leon/work/tools/gtgjx_leon/logs/*_filebeat.log
      #- c:\programdata\elasticsearch\logs\*
  
  fields:
    index: 'logsleon'
  json.keys_under_root: true
  json.overwrite_keys: true
  
- type: log

  # Change to true to enable this input configuration.
  enabled: true

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    #- /var/log/*.log
    - /home/elsearch/work/logs/*_filebeat.log
    #- /home/leon/work/tools/gtgjx_leon/logs/*_filebeat.log
    #- c:\programdata\elasticsearch\logs\*

  # Exclude lines. A list of regular expressions to match. It drops the lines that are
  # matching any regular expression from the list.
  #exclude_lines: ['^DBG']

  # Include lines. A list of regular expressions to match. It exports the lines that are
  # matching any regular expression from the list.
  #include_lines: ['^ERR', '^WARN']

  # Exclude files. A list of regular expressions to match. Filebeat drops the files that
  # are matching any regular expression from the list. By default, no files a
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值