# Why does translate not work here?

**URL:** <https://discuss.elastic.co/t/why-does-translate-not-work-here/123081>\
**Category:** Logstash\
**Created:** [March 8, 2018, 1:38pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-here/123081 "2018-03-08T13:38:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [March 8, 2018, 1:38pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-here/123081/1 "2018-03-08T13:38:55Z")

</div>

We would like to prioritize log messages of type WARN if they have a certain category.  
So we receive {"type": "WARN", "category": "DefaultEmailService", "priority": 2}  
and would like to output: {"type": "WARN", "category": "DefaultEmailService", "priority": 3}

The following works fine:

```
if [category] == "DefaultEmailService" and [type] == "WARN" {
	mutate { update => {"priority" => 3} }
}

```

We think however that we may have many such rules and that translate would be more elegant:

```
if [type] == "WARN" {
	translate {
		field => "category"
		destination => "priority"
		dictionary => {
			"DefaultEmailService" => 3
		}
	}
}

```

This does not update the priority field to 3 however. Why not?

![image](https://us1.discourse-cdn.com/elastic/original/3X/d/a/da96e5c5478f11f79d3e6d2c78987412b252b51f.png)

---

<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 8, 2018, 2:59pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-here/123081/2 "2018-03-08T14:59:55Z")

</div>

Try setting the [override](https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html#plugins-filters-translate-override) flag to `true` as the destination field already exists in the document.

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [March 16, 2018, 3:01pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-here/123081/3 "2018-03-16T15:01:08Z")

</div>

Yep, that did it thanks!

I guess I should RTM 🙂

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [March 27, 2018, 9:47am UTC](https://discuss.elastic.co/t/why-does-translate-not-work-here/123081/4 "2018-03-27T09:47:36Z")

</div>

Just noticed that translate does not like comments inside the dictionary.

The following totally craps out:

```
dictionary => {
	"DefaultEmailService" => 3 # Email not sent is an error
	"BcpSapPricingBackendERP" => 1 # Ignore
}

```

> :ConfigurationError", :message=\>"Expected one of #, {, } at ...

---

<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 24, 2018, 9:48am UTC](https://discuss.elastic.co/t/why-does-translate-not-work-here/123081/5 "2018-04-24T09:48:05Z")

</div>

Closed on April 24, 2018, 9:48am UTC

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