# How to connect to Kafka using filebeat with PLAINTEXT SecurityProtocol?

**URL:** https://discuss.elastic.co/t/how-to-connect-to-kafka-using-filebeat-with-plaintext-securityprotocol/336996
**Category:** Beats
**Tags:** filebeat
**Created:** [June 27, 2023, 1:18pm UTC](https://discuss.elastic.co/t/how-to-connect-to-kafka-using-filebeat-with-plaintext-securityprotocol/336996 "2023-06-27T13:18:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![wymli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wymli/32/122768_2.png) [@wymli](https://discuss.elastic.co/u/wymli)
#### Post date: [June 27, 2023, 1:18pm UTC](https://discuss.elastic.co/t/how-to-connect-to-kafka-using-filebeat-with-plaintext-securityprotocol/336996/1 "2023-06-27T13:18:43Z")

</div>

At present, the security-protocols of kafka mainly include the following `PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL`. But I checked the kafka-output documentation: [Configure the Kafka output | Filebeat Reference [8.8] | Elastic](https://www.elastic.co/guide/en/beats/filebeat/current/kafka-output.html), and found that there is no option for PLAINTEXT. How can I use PLAINTEXT to connect to my kafka brokers?

The error I have received so far is: `kafka: couldn't fetch broker metadata (check that your client and broker are using the same encryption and authentication settings)`

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [June 27, 2023, 1:31pm UTC](https://discuss.elastic.co/t/how-to-connect-to-kafka-using-filebeat-with-plaintext-securityprotocol/336996/2 "2023-06-27T13:31:56Z")

</div>

What does your filebeat configuration looks like?

PLAINTEXT is the default if you do not configure any security layer on Kafka.

---

<div class="post-metadata">

### Author: ![wymli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wymli/32/122768_2.png) [@wymli](https://discuss.elastic.co/u/wymli)
#### Post date: [June 27, 2023, 1:36pm UTC](https://discuss.elastic.co/t/how-to-connect-to-kafka-using-filebeat-with-plaintext-securityprotocol/336996/3 "2023-06-27T13:36:39Z")

</div>

Thanks, it seems that there are other problems. My configuration is posted below. I can produce and consume messages with this kafka broker address and topic in python.

```auto
output.kafka:
  enabled: true
  hosts:
    [
      "10.129.223.255:9094",
      "10.129.191.254:9094",
      "10.129.191.253:9094",
      "10.129.255.251:9094",
    ]
  topic: "test_lwm_log"
  partition.round_robin:
    reachable_only: true    
  required_acks: 1
  compression: gzip
  max_message_bytes: 1000000 # 1M

```

---

<div class="post-metadata">

### Author: ![wymli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wymli/32/122768_2.png) [@wymli](https://discuss.elastic.co/u/wymli)
#### Post date: [June 28, 2023, 7:06am UTC](https://discuss.elastic.co/t/how-to-connect-to-kafka-using-filebeat-with-plaintext-securityprotocol/336996/4 "2023-06-28T07:06:15Z")

</div>

I solved it finnaly. We should give a correct `version` field. In this case, when I use `0.8.2.0`, it worked well, while other versions will fail.  
In fact, My kafka version is `2.2.1` if I run `kafka-broker-api-versions.sh` to see the kafka broker version.

---

<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: [July 26, 2023, 9:06am UTC](https://discuss.elastic.co/t/how-to-connect-to-kafka-using-filebeat-with-plaintext-securityprotocol/336996/5 "2023-07-26T09:06:55Z")

</div>

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