Logstash uses protobuf, running error: NoMethodError", :message=>"undefined method `msgclass' for nil:NilClass"

I use logstash to accept message data in the format protobuf,
the protobuf.conf is setting :

input {
  beats {
	port => 5044
	ssl => false
	codec => protobuf {
	  class_name => ["Elk.ElkData"]
	  include_path => ["/home/logstash/test_code/elk.pb.rb"]
	  protobuf_version => 3
	}
	type => "protobuf"
  }
}

output {
  stdout { codec => rubydebug }
}

The elk.pb.rb file is generated by the "ruby-protocl elk" command。elk.pb.rb:

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

require 'protocol_buffers'

module Elk
  # forward declarations
  class ElkData < ::ProtocolBuffers::Message; end

  class ElkData < ::ProtocolBuffers::Message
    set_fully_qualified_name "elk.ElkData"

    optional :string, :table, 1
    optional :int64, :start, 2
    optional :int64, :end, 3
    optional :string, :pattern, 4
    optional :string, :columns, 5
    optional :string, :is_statistic, 6
    optional :int32, :top_cols, 7
    optional :string, :stat_cols, 8
    optional :int32, :count, 9
    optional :string, :user, 10
  end

end

Run the comment

bin/logstash -f protobuf.conf

the error :

[ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exceptio n=>"NoMethodError", :message=>"undefined method msgclass' for nil:NilClass", :backtrace=>["/home/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-codec-pr otobuf-1.1.0/lib/logstash/codecs/protobuf.rb:101:in register'", "/home/logstash/logstash-core/lib/logstash/codecs/base.rb:20:in initialize'", "/home/logs tash/logstash-core/lib/logstash/plugins/plugin_factory.rb:97:in plugin'", "/home/logstash/logstash-core/lib/logstash/pipeline.rb:110:in plugin'", "(eval) :8:in '", "org/jruby/RubyKernel.java:994:in eval'", "/home/logstash/logstash-core/lib/logstash/pipeline.rb:82:in initialize'", "/home/logstash/log stash-core/lib/logstash/pipeline.rb:167:in initialize'", "/home/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:40:in execute'", "/home/log stash/logstash-core/lib/logstash/agent.rb:305:in `block in converge_state'"]}

the msgclass in /home/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-codec-protobuf-1.1.0/lib/logstash/codecs/protobuf.rb:101 file :

protoc version is libprotoc 3.6.1, and the logstash version is 6.3.0. I can run under the 2.5 version of protoc.

I have consulted a lot of information and found no solution. What am I missing or where is the error? Looking forward to your answer

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