# Output plugin for kafka discovery

**URL:** https://discuss.elastic.co/t/output-plugin-for-kafka-discovery/132458
**Category:** Logstash
**Created:** [May 18, 2018, 10:01am UTC](https://discuss.elastic.co/t/output-plugin-for-kafka-discovery/132458 "2018-05-18T10:01:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Akash\_Kumar\_Dutta](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Akash\_Kumar\_Dutta](https://discuss.elastic.co/u/Akash_Kumar_Dutta)
#### Post date: [May 18, 2018, 10:01am UTC](https://discuss.elastic.co/t/output-plugin-for-kafka-discovery/132458/1 "2018-05-18T10:01:28Z")

</div>

I am fairly new to logstash.

I want to send the logs coming to logstash to a kafka cluster (already running as a k8s service).  
I know I need to configure the output plugin inside a configMap. From what I have seen [here](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-kafka.html), it mentions pretty much the env variables that need to be set up. After reading I didn't find exactly how my logstash will be discovering my kafka cluster. I mean it must have something like "kafk-service:kafka-port" for connecting the kafka service to logstash. But I don't see any env variable for that.

Currently, I have my configuration looking as:

```
input {
  tcp {
    port => 5044
    codec => "json"
  }
}
output {
  kafka {
    hosts => "kafka-service:9092"
    index => "logstash-%{+YYYY.MM.dd}"
    id => "id=1"
  }
}

```

I'm not sure about the `hosts` env variable. That is the doubt: what is the env variable that connects logstash to kafka cluster.  
I will really appreciate any help regarding this (better if I can find a documentation for this) . Thanks.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [May 22, 2018, 9:23am UTC](https://discuss.elastic.co/t/output-plugin-for-kafka-discovery/132458/2 "2018-05-22T09:23:48Z")

</div>

Use the kafka output's `bootstrap_servers` option.

---

<div class="post-metadata">

### Author: ![Akash\_Kumar\_Dutta](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Akash\_Kumar\_Dutta](https://discuss.elastic.co/u/Akash_Kumar_Dutta)
#### Post date: [May 22, 2018, 1:53pm UTC](https://discuss.elastic.co/t/output-plugin-for-kafka-discovery/132458/3 "2018-05-22T13:53:40Z")

</div>

Thank you! 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 19, 2018, 1:53pm UTC](https://discuss.elastic.co/t/output-plugin-for-kafka-discovery/132458/4 "2018-06-19T13:53:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
