Skip to content

Cannot use protobuf codec with http input #34

@PhilippHomann

Description

@PhilippHomann

When using http input combined with protobuf codec I receive following error:
[WARN ][logstash.codecs.protobuf ] Couldn't decode protobuf: #<ProtocolBuffers::DecodeError: too many bytes when decoding varint>.
with other proto
Couldn't decode protobuf: #<ProtocolBuffers::DecodeError: invalid message>

Tested with the very basic unicorn.proto from here, I receive error message above when using the protobuf codec with http input.
With tcp input everything works fine.

tcp.conf:

input {
	tcp {
		port => 5000
		codec => protobuf
		{
		    class_name => "Animal::Unicorn"
                    include_path => ["/unicorn.pb.pb.rb"]
		}
	}
}
output { stdout { } }

http.conf:

input {
	http {
		port => 5000
		codec => protobuf
		{
		    class_name => "Animal::Unicorn"
                    include_path => ["/unicorn.pb.pb.rb"]
		}
	}
}
output { stdout { } }

unicorn.pb.pb.rb:

#!/usr/bin/env ruby
# Generated by the protocol buffer compiler. DO NOT EDIT!

require 'protocol_buffers'

module Animal
  # forward declarations
  class Unicorn < ::ProtocolBuffers::Message; end

  class Unicorn < ::ProtocolBuffers::Message
    set_fully_qualified_name "Animal.Unicorn"

    optional :string, :colour, 1
    optional :int32, :horn_length, 2
    optional :int64, :last_seen, 3
  end

end

unicorn.bin (base64):

Cg5yZWQtYmx1ZS13aGl0ZRD///////////8BGAA=

Input to logstash is done by:

curl -XPOST --data-binary @unicorn.bin http://127.0.0.1:5000
nc 127.0.0.1 5000 < unicorn.bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions