My incoming message has nested protobuf structure, and I am using the protobuf-codec in Kafka-input.
Following is my configuration
// conf file
input
{
kafka
{
bootstrap_servers => "server"
client_id => "logstash-test-c1"
group_id => "logstash-test-g1"
topics => "topic"
auto_offset_reset => "earliest"
key_deserializer_class => "org.apache.kafka.common.serialization.ByteArrayDeserializer"
value_deserializer_class => "org.apache.kafka.common.serialization.ByteArrayDeserializer"
decorate_events => "true"
codec => protobuf
{
class_name => "B::I"
class_file => "/com/xyz/b/example.pb.rb"
protobuf_root_directory => "/com/xyz/"
}
}
output
{
s3
{
access_key_id => "key_id"
secret_access_key => "secret"
region => "region"
bucket => "bucket"
prefix => "bucket/%{+YYYY}/%{+MM}/%{+dd}/"
codec => "json_lines"
}
}
// Proto class B::I which is referred in class_name
syntax = "proto2";
package b;
option java_package = "com.xyz.b";
option java_outer_classname = "Example";
import "c/common.proto";
message I {
required string id = 1;
required c.IType i_type = 2;
required c.Seller seller = 3;
}
//Dependent class common.proto
syntax = "proto2";
package c;
option java_package = "com.xyz.c";
option java_outer_classname = "Common";
enum IType {
ABC = 0;
PQR = 1;
}
message Seller {
required int64 id = 1;
enum SellerType {
SEL1 = 0;
SEL2 = 1;
}
required SellerType type = 5;
}
With this I get following output Json
{
"id":"56473",
"i_type":0,
"seller":
{
"type":0,
"id":101
}
}
Where as I need the output to be
{
"id":"56473",
"i_type": "ABC",
"seller":
{
"type": "SEL1",
"id":101
}
}
Is there anything wrong with the conf or the protobuf codec does not provide this functionality?
Any help is appreciated.
Thanks