# Logstash with Kafka: Unable to decode avro

**URL:** https://discuss.elastic.co/t/logstash-with-kafka-unable-to-decode-avro/32457
**Category:** Logstash
**Created:** [October 19, 2015, 7:13am UTC](https://discuss.elastic.co/t/logstash-with-kafka-unable-to-decode-avro/32457 "2015-10-19T07:13:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mgarg](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mgarg](https://discuss.elastic.co/u/mgarg)
#### Post date: [October 19, 2015, 7:13am UTC](https://discuss.elastic.co/t/logstash-with-kafka-unable-to-decode-avro/32457/1 "2015-10-19T07:13:50Z")

</div>

I am trying to consume serialized avro events from a Kafka Queue. The kafka queue is populated using a simple java producer. For clarity I am sharing the three components:

Avro schema file

{"namespace": "example.avro",  
"type": "record",  
"name": "User",  
"fields": [  
{"name": "name", "type": "string"},  
{"name": "favorite\_number", "type": ["int", "null"]},  
{"name": "favorite\_color", "type": ["string", "null"]}  
]  
}

Logstash Config file

input {  
kafka {  
zk\_connect =\> "localhost:2181"  
topic\_id =\> "MemoryTest"  
type =\> "standard\_event"  
group\_id =\> "butiline\_dash\_prod"  
reset\_beginning =\> true  
auto\_offset\_reset =\> smallest  
codec =\> {  
avro =\> {  
schema\_uri =\> "/opt/ELK/logstash-1.5.4/bin/user.avsc"  
}  
}  
}  
}

output {  
if [type] == "standard\_event" {  
stdout {  
codec =\> rubydebug  
}  
}  
}  
Problem

The pipeline fails at logstash level. When a new event is pushed into Kafka, I get following on logstash console:

Alyssa�blue {:exception=\> # \< NoMethodError: undefined method `decode' for ["avro", {"schema_uri"=>"/opt/ELK/logstash-1.5.4/bin/user.avsc"}]:Array>, :backtrace=>["/opt/ELK/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-input-kafka-1.0.0/lib/logstash/inputs/kafka.rb:169:in`queue\_event'", "/opt/ELK/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-input-kafka-1.0.0/lib/logstash/inputs/kafka.rb:139:in `run'", "/opt/ELK/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:177:in`inputworker'", "/opt/ELK/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:171:in `start\_input'"], :level=\>:error}

---

<div class="post-metadata">

### Author: ![mgarg](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mgarg](https://discuss.elastic.co/u/mgarg)
#### Post date: [October 19, 2015, 10:18am UTC](https://discuss.elastic.co/t/logstash-with-kafka-unable-to-decode-avro/32457/2 "2015-10-19T10:18:13Z")

</div>

Finally figured out the error. Instead of this (As suggested on Logstash website - [https://www.elastic.co/guide/en/logstash/current/plugins-codecs-avro.html](https://www.elastic.co/guide/en/logstash/current/plugins-codecs-avro.html))

codec =\> {  
avro =\> {  
schema\_uri =\> "/opt/ELK/logstash-1.5.4/bin/user.avsc"  
}  
}

The correct syntax is (as suggested in the plugin's documentation [https://github.com/logstash-plugins/logstash-codec-avro/blob/master/DEVELOPER.md](https://github.com/logstash-plugins/logstash-codec-avro/blob/master/DEVELOPER.md)):

codec =\> avro {  
schema\_uri =\> "/opt/ELK/logstash-1.5.4/bin/user.avsc"  
}

I guess the syntax is changed.

---

<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 6, 2017, 5:26am UTC](https://discuss.elastic.co/t/logstash-with-kafka-unable-to-decode-avro/32457/3 "2017-07-06T05:26:12Z")

</div>


