# Translate within mutate section

**URL:** <https://discuss.elastic.co/t/translate-within-mutate-section/137633>\
**Category:** Logstash\
**Created:** [June 27, 2018, 1:50pm UTC](https://discuss.elastic.co/t/translate-within-mutate-section/137633 "2018-06-27T13:50:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssi](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@ssi](https://discuss.elastic.co/u/ssi)\
**Post date:** [June 27, 2018, 1:50pm UTC](https://discuss.elastic.co/t/translate-within-mutate-section/137633/1 "2018-06-27T13:50:08Z")

</div>

hi i want to add some info in the event that a list of specific ips are contacted, from what i've seen the translate filter should be able to do this but i dont know if where to place it correctly below is not working

```
if [event_id] == 3 {
  mutate {
    add_field => { "action" => "networkconnect" }
    rename => {
      "[event_data][DestinationHostname]" => "host_dst_name"
      "[event_data][DestinationIp]" => "ip_dst"
      "[event_data][DestinationIsIpv6]" => "ip_dst_isipv6"
      "[event_data][DestinationPort]" => "port_dst_number"
      "[event_data][DestinationPortName]" => "port_dst_name"
      "[event_data][Initiated]" => "network_initiated"
      "[event_data][Protocol]" => "network_protocol"
      "[event_data][SourceHostname]" => "host_src_name"
      "[event_data][SourceIp]" => "ip_src"
      "[event_data][SourceIsIpv6]" => "ip_src_isipv6"
      "[event_data][SourcePort]" => "port_src_number"
      "[event_data][SourcePortName]" => "port_src_port_name"
    }  
   translate {
    field => "ip_dst"
     destination => "MaliciousIP"
     dictionary_path => /home/ssi/HELK/helk-logstash/firehol_BadIp4.yaml'
    } 
  }
  geoip {
    source => "ip_dst"
    remove_field => "[geoip][ip]"
  }

}

```

the yaml file has the following format

"IP\_BAD": "YES"

im using this "receipie"

> **[Detecting Outbound connections Pt. 2 - Logstash + Threat Intelligence - Syspanda](https://www.syspanda.com/index.php/2017/08/26/detecting-outbound-connections-pt-2-logstash-threat-intelligence/)**
>
> Now that you have been collecting outbound connection logs from sysmon or your firewalls, the next step is to ask ourselves, how do we enhance that data? Geo-tagging IP addresses,... \[Continue Reading\]

except i changed the logstash code to fit my current setup - with little success so far..

---

<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:** [June 27, 2018, 1:52pm UTC](https://discuss.elastic.co/t/translate-within-mutate-section/137633/2 "2018-06-27T13:52:38Z")

</div>

`mutate` and `translate` are two separate filters, so can not be nested like you have done. You need to place the `translate` filter after the `mutate` filter.

---

<div class="post-metadata">

**Author:** ![ssi](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@ssi](https://discuss.elastic.co/u/ssi)\
**Post date:** [June 27, 2018, 3:29pm UTC](https://discuss.elastic.co/t/translate-within-mutate-section/137633/3 "2018-06-27T15:29:33Z")

</div>

But still with the same filter statement right ? So i just move it outside the mutate section - right

Thanks for the Quick reply you rock

---

<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:** [July 25, 2018, 3:29pm UTC](https://discuss.elastic.co/t/translate-within-mutate-section/137633/4 "2018-07-25T15:29:34Z")

</div>

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