1. 程式人生 > >filebeat6.2.3收集多個日誌源 多個topic輸出

filebeat6.2.3收集多個日誌源 多個topic輸出

下載

wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.2.3-linux-x86_64.tar.gz

解壓

tar -zxvf filebeat-6.2.3-linux-x86_64.tar.gz

配置filebeat.yml

filebeat.prospectors:
- type: log
  enabled: true
  paths:
    - /var/log/mylog/test1.log
  fields:
    log_topics: test1
- type: log
  enabled: true
  paths:
    - /var/log/mylog/test2.log
  fields:
    log_topics: test2
output.kafka:
  enabled: true
  hosts: ["10.112.101.90:9092"]
  topic: '%{[fields][log_topics]}'

執行filebeat

./filebeat -e -c filebeat.yml