# Logstash mutate and translate the same field

**URL:** <https://discuss.elastic.co/t/logstash-mutate-and-translate-the-same-field/77489>\
**Category:** Logstash\
**Created:** [March 6, 2017, 11:17am UTC](https://discuss.elastic.co/t/logstash-mutate-and-translate-the-same-field/77489 "2017-03-06T11:17:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diyal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diyal/32/10110_2.png) [@Diyal](https://discuss.elastic.co/u/Diyal)\
**Post date:** [March 6, 2017, 11:17am UTC](https://discuss.elastic.co/t/logstash-mutate-and-translate-the-same-field/77489/1 "2017-03-06T11:17:37Z")

</div>

Hello,

I would like to make services translation like this:  
21/tcp =\> ftp  
80/tcp =\> http

But the translation doesn't work.

So, my services.yaml file is like this :  
"1/tcp": "tcpmux"  
"1/udp": "tcpmux"  
"5/tcp": "rje"  
"5/udp": "rje"  
"7/tcp": "echo"  
"7/udp": "echo"  
"9/tcp": "discard "  
"9/udp": "discard"  
"11/tcp": "systat"  
"11/udp": "systat"  
"13/tcp": "daytime  
.....

And my Logstash Configuration

```
                    filter {
                            mutate {

                            add_field => {"application_name" => "%{[netflow][l4_dst_port]}/%{protocol_name}"}
                            convert => {"application_name" => "string"}
                            }

                            translate {
                            field => "application_name"
                            destination => "application_name"
                            dictionary_path => "/opt/logstash/conf/services.yaml"
                            }

                    }
```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 6, 2017, 3:09pm UTC](https://discuss.elastic.co/t/logstash-mutate-and-translate-the-same-field/77489/2 "2017-03-06T15:09:10Z")

</div>

If you output your events to stdout using the stdout output plugin and the rubydebug codec, what do they look like?

---

<div class="post-metadata">

**Author:** ![Diyal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diyal/32/10110_2.png) [@Diyal](https://discuss.elastic.co/u/Diyal)\
**Post date:** [March 6, 2017, 4:03pm UTC](https://discuss.elastic.co/t/logstash-mutate-and-translate-the-same-field/77489/3 "2017-03-06T16:03:07Z")

</div>

It's resolved now :

filter {

```
                            mutate {
                                            add_field => {"app_name" => "%{[netflow][l4_dst_port]}/%{protocol_name}"}
                                    }
                    
                    
                            translate {
                            field => "app_name"
                            destination => "application_name"
                            dictionary_path => "/opt/logstash/conf/services.yaml"
                           
                            }

```

And I changed my services.yml file because the value doesn't contains =\> "

"1/tcp": "tcpmux" move to "1/tcp": tcpmux  
"1/udp": "tcpmux" move to "1/udp": tcpmux

So it was, my bad configuration in my yaml file

---

<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:** [April 3, 2017, 4:03pm UTC](https://discuss.elastic.co/t/logstash-mutate-and-translate-the-same-field/77489/4 "2017-04-03T16:03:31Z")

</div>

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