# Kafka Input JSON Codec

**URL:** <https://discuss.elastic.co/t/kafka-input-json-codec/230406>\
**Category:** Logstash\
**Created:** [April 29, 2020, 4:27pm UTC](https://discuss.elastic.co/t/kafka-input-json-codec/230406 "2020-04-29T16:27:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lifeofguenter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lifeofguenter/32/17384_2.png) [@lifeofguenter](https://discuss.elastic.co/u/lifeofguenter)\
**Post date:** [April 29, 2020, 4:27pm UTC](https://discuss.elastic.co/t/kafka-input-json-codec/230406/1 "2020-04-29T16:27:38Z")

</div>

From version 3.0.0 the default codec for kafka-input-plugin has been changed from json to plain (see: [https://github.com/logstash-plugins/logstash-input-kafka/blob/master/CHANGELOG.md#300beta2-1](https://github.com/logstash-plugins/logstash-input-kafka/blob/master/CHANGELOG.md#300beta2-1)).

One possibility would be to just set "codec" back to json, which I also did and it works.

However, what is the "recommended" way? The payloads coming from kafka are json strings (ecs-format: [https://www.elastic.co/guide/en/ecs/current/index.html](https://www.elastic.co/guide/en/ecs/current/index.html)), so I am having difficulty applying a json-filter on all of it, as json-filter works with single fields - not the whole row/line/document.

Any advice?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 29, 2020, 11:52pm UTC](https://discuss.elastic.co/t/kafka-input-json-codec/230406/2 "2020-04-29T23:52:17Z")

</div>

> [@lifeofguenter](#):
>
> I am having difficulty applying a json-filter on all of it, as json-filter works with single fields - not the whole row/line/document

I do not understand the issue. If the input is using the plain codec then the entire message is put in the [message] field, and you can parse it using

```
json { source => "message" }

```

---

<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:** [May 27, 2020, 11:58pm UTC](https://discuss.elastic.co/t/kafka-input-json-codec/230406/3 "2020-05-27T23:58:30Z")

</div>

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