Mar 22, 2021
How to configure Kafka topic and multiple hosts in Filebeat and run in Windows.
Give the paths
Add multiple hosts
In topic, mention the Kafka topic.
filebeat.inputs:
- type: log
enabled: true
paths:
- C:\FREESOFT\filebeat-7.11.2-windows-x86_64\demojson.jsonfilebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: falsesetup.template.settings:
tags: ["iss-sit"]processors:
- add_host_metadata: ~output.kafka:
enabled: true
hosts: ["host1.com:9092","host2.com:9092","host3.com:9092"]
topic: 'dem0-data-science-platform-mongodb-qa'
My data file is in json format and as per below.
{"id":9222968140491043000,"category":{"id":0,"name":"string"},"name":"doggie","photoUrls":["string"],"tags":[{"id":0,"name":"string"}],"status":"available"}
{"id":444,"category":{"id":0,"name":"string"},"name":"doggie","photoUrls":["string"],"tags":[{"id":0,"name":"string"}],"status":"available"}
{"id":55,"category":{"id":0,"name":"string"},"name":"bird","photoUrls":["string"],"tags":[{"id":0,"name":"string"}],"status":"available"}
go to the command line and relevant folder and run below command .
Adding -e flag means it prints the execution log details in console log.
prodfilebeat.yml is the filebeat file name.
.\filebeat.exe -e -c prodfilebeat.yml
To rerun from the beginning, delete the content in data folder which inside of filebeat-7.11.2-windows-x86_64 directory.