一、filebeat安装
filebeat-kafka版本适配
1、安装包下载
https://www.elastic.co/cn/downloads/past-releases#filebeat
解压
2、新建yml配置文件,如test.yml
filebeat.prospectors:
- input_type: log
paths:
- /data/test.log #配置需要采集的日志文件的全路径
document_type: "testtype" #为所采集的日志目录定义一个字段名为type的字段,用于为日志分类,便于区分查询
exclude_files: [".gz$"] #排除掉压缩文件
fields:
isInpendentSystem: false
business: "test" #业务名称
name: ip #对应的日志服务器的ip地址
max_procs: 1 #filebeat最大使用cpu数
max_bytes : 50000
output.kafka:
enabled: true
hosts: ["ip:9092"] #kafka集群地址
topic: 'testtopic' #topic名称,先创建好
compression: gzip
max_message_bytes: 1000000
username: "testuser" #topic使用权限用户名
password: "testpwd" #topic使用权限密码
3、Filebeat启动和停止
启动:./filebeat -c test.yml
停止:kill -9 PID



