原创

ELK学习二:filebeat收集

温馨提示:
本文最后更新于 2022年06月13日,已超过 683 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

下载安装地址:

https://www.elastic.co/cn/downloads/beats/filebeat

配置filebeat

filebeat配置分为2个部分,input和output:

input:

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

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

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - /var/log/*.log
    - /www/wwwlogs/**

output:

output.kafka:
  hosts: ["127.0.0.1:9092"]

  # 在这里通过引用fields来指定目标topic
  topic: 'test-input'
  version: 0.11.0.0
  compression: gzip
  max_message_bytes: 1000000

注意,开启kafka output需要在modules.d/中将kafka.yml.disable改名为 kafka.yml

启动filebeat

./filebeat -e -c filebeat.yml -d "publish"    # 直接启动查看启动日志
nohup ./filebeat -e -c filebeat.yml >/dev/null 2>&1 &  # 后台方式启动

仙士可博客

正文到此结束
本文目录