# I need to translate codes into descriptions

**URL:** https://discuss.elastic.co/t/i-need-to-translate-codes-into-descriptions/29786
**Category:** Logstash
**Created:** [September 22, 2015, 2:22pm UTC](https://discuss.elastic.co/t/i-need-to-translate-codes-into-descriptions/29786 "2015-09-22T14:22:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jjdepaul](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jjdepaul](https://discuss.elastic.co/u/jjdepaul)
#### Post date: [September 22, 2015, 2:22pm UTC](https://discuss.elastic.co/t/i-need-to-translate-codes-into-descriptions/29786/1 "2015-09-22T14:22:14Z")

</div>

We are processing log files that track how orders flow through the fulfillment workflow. One of the elements we capture is the status code, which is a 2-3 character acronym which translates to a meaningful description - example: OR = Order Received, VS = Validation Successful, OF = Order Failed, etc.

I need to find a way to translate these codes (which may not mean anything to our users) into the descriptions which they represent. I plan on recording this info in ElasticSearch as output and Kibana to search/present results.

Is there concept of a lookup table concept in LS, or ES that I could apply to achieve this nicely?!

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [September 22, 2015, 2:29pm UTC](https://discuss.elastic.co/t/i-need-to-translate-codes-into-descriptions/29786/2 "2015-09-22T14:29:46Z")

</div>

Have a look at the [translate filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html).

---

<div class="post-metadata">

### Author: ![jjdepaul](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jjdepaul](https://discuss.elastic.co/u/jjdepaul)
#### Post date: [September 23, 2015, 3:51pm UTC](https://discuss.elastic.co/t/i-need-to-translate-codes-into-descriptions/29786/3 "2015-09-23T15:51:56Z")

</div>

It worked like a "charm"... thank you!

Here is my config, for future searchers:

```
filter {
  # Parse out the statusCode variable
      grok { 
          match => { 
            "message" => [ 
            "status=(%{WORD:statusCode})$"
                ] 
          } 
      }
      # Translate statusCode variable into statusDescription (new field)
      translate {
        field => "statusCode"
        destination => "statusDescription"
        dictionary_path => "order_status_codes.txt"
      }
}

```

and my YAML file is simply this:

```
CW: Waiting on Order Desk
CWS: Order Desk successfully completed.
CWF: Order Desk failed.
```

---

<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 6, 2017, 5:28am UTC](https://discuss.elastic.co/t/i-need-to-translate-codes-into-descriptions/29786/4 "2017-07-06T05:28:15Z")

</div>


