# Logstash does not map enum values in protobuf codec

**URL:** <https://discuss.elastic.co/t/logstash-does-not-map-enum-values-in-protobuf-codec/228859>\
**Category:** Logstash\
**Created:** [April 20, 2020, 12:11pm UTC](https://discuss.elastic.co/t/logstash-does-not-map-enum-values-in-protobuf-codec/228859 "2020-04-20T12:11:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhanashri-pitre](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@dhanashri-pitre](https://discuss.elastic.co/u/dhanashri-pitre)\
**Post date:** [April 20, 2020, 12:11pm UTC](https://discuss.elastic.co/t/logstash-does-not-map-enum-values-in-protobuf-codec/228859/1 "2020-04-20T12:11:25Z")

</div>

My incoming message has nested protobuf structure, and I am using the protobuf-codec in Kafka-input.  
Following is my configuration  
// conf file

```auto
    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

```auto
    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

```auto
    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

---

<div class="post-metadata">

**Author:** ![dhanashri-pitre](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@dhanashri-pitre](https://discuss.elastic.co/u/dhanashri-pitre)\
**Post date:** [April 21, 2020, 8:29am UTC](https://discuss.elastic.co/t/logstash-does-not-map-enum-values-in-protobuf-codec/228859/2 "2020-04-21T08:29:09Z")

</div>

@IngaFeick, @magnusbaeck , any help or pointers on this ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 19, 2020, 8:29am UTC](https://discuss.elastic.co/t/logstash-does-not-map-enum-values-in-protobuf-codec/228859/3 "2020-05-19T08:29:10Z")

</div>

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