2

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?

0

1 Answer 1

8

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"
  }
}
Sign up to request clarification or add additional context in comments.

2 Comments

Val, I need one more help. If I want Kafka as Output, is it fine if I mention like the answer I have mentioned below : input { kafka { bootstrap_servers => "localhost:9092" topics => ["beatsab"] } } output { kafka { bootstrap_servers => "localhost:9092" topics => ["sound"] } }
No in the output, you need topic_id instead of topics

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.