简体   繁体   中英

logstash kafka input not working

I am trying to get the data from Kafka and push it to ElasticSearch.

Here is the logstash configuration I am using:

input {
kafka {
zk_connect => "localhost:2181"
topic_id => "beats"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "elasticse"
}
}

Can anyone help here with the logstash configuration? If I run this I am getting invalid configuration error.

D:\logstash-5.0.0\bin>logstash -f log-uf.conf
Sending Logstash logs to D:\logstash-5.0.0\logs\logstash-plain.txt which is now
configured via log4j2.properties.
[2016-11-11T16:31:32,429][ERROR][logstash.inputs.kafka    ] Unknown setting 'zk_
connect' for kafka
[2016-11-11T16:31:32,438][ERROR][logstash.inputs.kafka    ] Unknown setting 'top
ic_id' for kafka
[2016-11-11T16:31:32,452][ERROR][logstash.agent           ] fetched an invalid c
onfig {:config=>"input {\n   kafka {\n   zk_connect => \"localhost:2181\"\n   to
pic_id => \"beats\"\n   consumer_threads => 16\n  }\n}\noutput {\nelasticsearch
{\nhosts => [\"localhost:9200\"]\nindex => \"elasticse\"\n}\n}\n", :reason=>"Som
ething is wrong with your configuration."}

can anyone help here?

You're running Logstash 5 with a config for Logstash 2.4.

zk_connect (Zookeeper host) was replaced by bootstrap_servers (Kafka broker) and topic_id by topics in 5.0

Try this config instead:

input {
  kafka {
    bootstrap_servers => "localhost:9092"
    topics => ["beats"]
  }
}
output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "elasticse"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM