logstash-plugins / logstash-codec-avro

A logstash codec plugin for decoding and encoding Avro records
Apache License 2.0
15 stars 63 forks source link

Logstash with Kafka: Unable to decode avro #12

Closed mohitgargk closed 7 years ago

mohitgargk commented 8 years ago

My schema file (user.avsc) is -

{"namespace": "example.avro", "type": "record", "name": "User", "fields": [ {"name": "name", "type": "string"}, {"name": "favorite_number", "type": ["int", "null"]}, {"name": "favorite_color", "type": ["string", "null"]} ] }

And 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" } } } } }

I am getting error on logstash console as:

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:inqueue_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:inrun'", "/opt/ELK/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:177:ininputworker'", "/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}

original-brownbear commented 7 years ago

@suyograo @jsvd looking into the Kafka issue from https://discuss.elastic.co/t/logstash-kafka-avro-codec-error-with-doubles/79483 here (this one looks a little different, but the underlying issue in the forum post blocks this one too imo). Though it looks like the fix is rather going to be in the kafka plugin than here.

suyograo commented 7 years ago

Fixed in https://github.com/logstash-plugins/logstash-codec-avro/pull/24