Protobuf data decode issue

Here is the code to read the protobuf data from pubsub and decode in logstash but we are unable to decode the protobuf data.

Code:

  input {
   google_pubsub {
        project_id => "project_id"
        topic => "topic_name"
        subscription => "subscription_name"
        json_key_file => "/etc/logstash/project_name/key.json"
        create_subscription => false
        codec => protobuf
        {
          class_name => "class_name"
          class_file => ['class_name_pb.rb']
          protobuf_root_directory => "/etc/logstash/project_name/protobuf/"
          protobuf_version => 3
        }
    }
}
output { stdout { codec => rubydebug } }

ERROR Message:
[ERROR] 2023-04-05 10:58:16.518 [Converge PipelineAction::Create] protobuf - Unable to load file: /etc/logstash/project_name/protobuf/class_name_pb.rb. Reason: #<NoMethodError: undefined method add_file' for #<Google::Protobuf::Builder:0x54501fc9>> [ERROR] 2023-04-05 10:58:16.521 [Converge PipelineAction::Create<main>] agent - Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"Java::JavaLang::IllegalStateException", :message=>"Unable to configure plugins: (NoMethodError) undefined method add_file' for #Google::Protobuf::Builder:0x54501fc9", :

Above I used 3.20.0 protoc version

I have referred few google comments and they suggested to use protoc 3.5.0 Version. But when I used protoc 3.5.0 Version I did not get any error but Logstash code was not reading any data.

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