下载安装地址:
https://www.elastic.co/cn/downloads/beats/filebeat
配置filebeat
filebeat配置分为2个部分,input和output:
input:
代码语言:javascript复制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:
代码语言:javascript复制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
代码语言:javascript复制./filebeat -e -c filebeat.yml -d "publish" # 直接启动查看启动日志
nohup ./filebeat -e -c filebeat.yml >/dev/null 2>&1 & # 后台方式启动
本文为仙士可原创文章,转载无需和我联系,但请注明来自仙士可博客www.php20.cn