我开始使用从kafka到logstash的消息,我想将完整主题发送到elasticSearch,但我没有在logstash上收到任何消息,我可以在kafka中看到消息传来,但是从卡夫卡那边我什么都看不到,配置它的正确方法是什么?
input {
kafka {
zk_connect => "localhost:2181"
topic_id => "event"
}
}
output{
stdout{
codec => rubydebug
}
elasticsearch{
index => "event-%{+YYYY.MM.dd}"
hosts => ["localhost:9201"]
codec => json
}
}
curl localhost:9201
{
"name" : "Flex",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.3.4",
"build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",
"build_timestamp" : "2016-06-30T11:24:31Z",
"build_snapshot" : false,
"lucene_version" : "5.5.0"
},
"tagline" : "You Know, for Search"
}
命令:
/kafka-console-consumer.sh --zookeeper localhost:2181 --topic event
不时产生结果。
答案 0 :(得分:1)
使用auto_offset_reset
和reset_beginning
:
kafka {
topic_id => "event"
zk_connect => "localhost:2181"
group_id => "event-group"
auto_offset_reset => "smallest"
reset_beginning => true
consumer_threads => 1
}