51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

filebeat对接kafka

filebeat对接kafka

  • 模拟filebeat作为生产者

1.启动消费者

kafka-console-consumer.sh --bootstrap-server  10.0.0.111:9092 --topic dashu86-jiaoshi03 


2.启动filebeat
[root@elk111 ~]# cat config/logtokafka.yaml

filebeat.inputs:
- type: log
  paths: ["/tmp/kafka.log"]

output.kafka:
  hosts: ["10.0.0.111:9092", "10.0.0.112:9092"]
  topic: 'dashu86-jiaoshi03'

filebeat -e -c config/logtokafka.yml
  • 模拟filebeat作为消费者

1.启动生产者生产数据

kafka-console-producer.sh  --bootstrap-server 10.0.0.111:9092 --topic dashu86-jiaoshi03 


2.启动filebeat

kafkatoes.yaml

[root@baimeidashu-elk111 ~/config]#cat kafkatoes.yaml 
filebeat.inputs:
- type: kafka
  hosts:
    - 10.0.0.111:9092
    - 10.0.0.112:9092
  topics: ["dashu86-jiaoshi03"]
  group_id: "jiaoshi03"
  
output.console:
  pretty: true

启动

filebeat -e -c /root/config/kafkatoes.yaml  --path.data=/tmp/11



https://www.elastic.co/guide/en/beats/filebeat/7.17/kafka-output.html

赞(1)
未经允许不得转载:工具盒子 » filebeat对接kafka