CentOS安裝filebeat收集日志到kafka
作者:linux運維菜
filebeat是日志數據采集器,可代替logstash收集日志,部署起來比較方便。一般日志量比較大,會先收集到kafka然后再進行消費。
簡介
filebeat是日志數據采集器,可代替logstash收集日志,部署起來比較方便。
一般日志量比較大,會先收集到kafka然后再進行消費。
安裝
- yum -y install https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum/7.14.0/filebeat-7.14.0-x86_64.rpm

配置filebeat
- vim /etc/filebeat/filebeat.yml
- filebeat.inputs:
- - type: log
- paths:
- - /var/log/*.log
- - /var/log/messages
- fields:
- type: "systemlog"
- log_topic: "systemlog"
- fields_under_root: true
- exclude_lines: ["^DBG"]
- exclude_files: [".gz$"]
- name: 192.168.122.100
- output.kafka:
- enabled: true
- hosts: ["192.168.122.200:9092"]
- topic: "%{[log_topic]}"
- partition.round_robin:
- reachable_only: true
- worker: 2
- required_acks: 1
- compression: gzip
- max_message_bytes: 10000000
服務管理
- systemctl enable filebeat
- systemctl start filebeat
總結
filebeat是Go寫的,部署起來很方便,沒什么依賴,批量部署簡單。
責任編輯:姜華
來源:
今日頭條