#======= For versions later than Filebeat 7.x, change `filebeat.prospectors` to `filebeat.inputs` =======filebeat.prospectors:- input_type: log# This is the monitoring file path.paths:- /var/log/messages#======= Outputs =========#------------------ kafka -------------------------------------output.kafka:version:0.10.2 // Configure them according to different CKafka instance open-source versions.# Set the CKafka connection address.hosts: ["xx.xx.xx.xx:xxxx"]# Set the name of the target topic.topic: 'test'partition.round_robin:reachable_only: falserequired_acks: 1compression: nonemax_message_bytes: 1000000# SASL requires the following information to be configured. If SASL is not needed, you can skip the following two options.username: "yourusername"password: "yourpassword"
Parameter | Description |
host | The connection address. It can be obtained from the basic information page of an elastic Topic in the console. |
username | The username. It can be obtained from the basic information page of an elastic Topic in the console. |
password | The user password. It can be obtained from the basic information page of an elastic Topic in the console. |
topic | The topic name. It can be obtained from the basic information page of an elastic Topic in the console. |
sudo ./filebeat -e -c filebeat.yml
echo ckafka1 >> testlogecho ckafka2 >> testlogecho ckafka3 >> testlog
{"@timestamp":"2017-09-29T10:01:27.936Z","beat":{"hostname":"10.193.9.26","name":"10.193.9.26","version":"5.6.2"},"input_type":"log","message":"ckafka1","offset":500,"source":"/data/ryanyyang/hcmq/beats/filebeat-5.6.2-linux-x86_64/testlog","type":"log"}{"@timestamp":"2017-09-29T10:01:30.936Z","beat":{"hostname":"10.193.9.26","name":"10.193.9.26","version":"5.6.2"},"input_type":"log","message":"ckafka2","offset":508,"source":"/data/ryanyyang/hcmq/beats/filebeat-5.6.2-linux-x86_64/testlog","type":"log"}{"@timestamp":"2017-09-29T10:01:33.937Z","beat":{"hostname":"10.193.9.26","name":"10.193.9.26","version":"5.6.2"},"input_type":"log","message":"ckafka3","offset":516,"source":"/data/ryanyyang/hcmq/beats/filebeat-5.6.2-linux-x86_64/testlog","type":"log"}
# SASL requires the following information to be configured. If SASL is not needed, you can skip the next two options.username: "yourusername"password: "yourpassword"
/var/log/filebeat/filebeat
), such as:2019-03-20T08:55:02.198+0800 INFO kafka/log.go:53 producer/broker/544 starting up2019-03-20T08:55:02.198+0800 INFO kafka/log.go:53 producer/broker/544 state change to [open] on wp-news-filebeat/42019-03-20T08:55:02.198+0800 INFO kafka/log.go:53 producer/leader/wp-news-filebeat/4 selected broker 5442019-03-20T08:55:02.198+0800 INFO kafka/log.go:53 producer/broker/478 state change to [closing] because EOF2019-03-20T08:55:02.199+0800 INFO kafka/log.go:53 Closed connection to broker bitar1d12:90922019-03-20T08:55:02.199+0800 INFO kafka/log.go:53 producer/leader/wp-news-filebeat/5 state change to [retrying-3]2019-03-20T08:55:02.199+0800 INFO kafka/log.go:53 producer/leader/wp-news-filebeat/4 state change to [flushing-3]2019-03-20T08:55:02.199+0800 INFO kafka/log.go:53 producer/leader/wp-news-filebeat/5 abandoning broker 4782019-03-20T08:55:02.199+0800 INFO kafka/log.go:53 producer/leader/wp-news-filebeat/2 state change to [retrying-2]2019-03-20T08:55:02.199+0800 INFO kafka/log.go:53 producer/leader/wp-news-filebeat/2 abandoning broker 5412019-03-20T08:55:02.199+0800 INFO kafka/log.go:53 producer/leader/wp-news-filebeat/3 state change to [retrying-2]2019-03-20T08:55:02.199+0800 INFO kafka/log.go:53 producer/broker/478 shut down
output.kafka:version:0.10.2 // Configure them according to different CKafka instance open-source versions.
Was this page helpful?