#======= Filebeat7.x之后的版本,将 filebeat.prospectors 修改为 filebeat.inputs 即可 =======filebeat.prospectors:- input_type: log# 此处为监听文件路径paths:- /var/log/messages#======= Outputs =========#------------------ kafka -------------------------------------output.kafka:version:0.10.2 // 根据不同 CKafka 实例开源版本配置# 设置为CKafka接入地址hosts: ["xx.xx.xx.xx:xxxx"]# 设置目标topic的名称topic: 'test'partition.round_robin:reachable_only: falserequired_acks: 1compression: nonemax_message_bytes: 1000000# SASL 需要配置下列信息,如果不需要则下面两个选项可不配置username: "yourusername"password: "yourpassword"
参数 | 描述 |
host | 接入地址,在控制台的弹性 Topic 基本信息页面获取。 |
username | 用户名,在控制台的弹性 Topic 基本信息页面获取。 |
password | 用户密码,在控制台的弹性 Topic 基本信息页面获取。 |
topic | Topic 名称,在控制台的弹性 Topic 基本信息页面获取。 |
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 需要配置下列信息,如果不需要则下面两个选项可不配置username: "yourusername"password: "yourpassword"
/var/log/filebeat/filebeat
)中,发现有大量 INFO 日志,例如: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 // 根据不同 CKafka 实例开源版本配置
本页内容是否解决了您的问题?