# Logstash Grok And Translate

**URL:** https://discuss.elastic.co/t/logstash-grok-and-translate/47503
**Category:** Logstash
**Created:** [April 15, 2016, 1:33pm UTC](https://discuss.elastic.co/t/logstash-grok-and-translate/47503 "2016-04-15T13:33:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Gnosis](https://avatars.discourse-cdn.com/v4/letter/g/3e96dc/32.png) [@Gnosis](https://discuss.elastic.co/u/Gnosis)
#### Post date: [April 15, 2016, 1:33pm UTC](https://discuss.elastic.co/t/logstash-grok-and-translate/47503/1 "2016-04-15T13:33:23Z")

</div>

Hi All,

I'd like to use translate to look for a pattern in a file.  
Once i have the pattern in field i'd like to use this field as a pattern in my grok but it doesn't seems to work properly.

I explain, i have a YAML file with two columns :

```
1: "%{WORD:field1};%{WORD:FIELD2}"
...

```

My conf logstash is like that :

```
input{
....
}

filter {

grok { "message" => "%{WORD:key}" }

translate { 
                 dictionary_path => "path_to_my_yaml_file"
                 field => "key"
                 destination => "myGrokPattern"
                 }

grok { "message" => "myGrokPattern" } 

}

output { .... }

```

Is it possible to do this way ? do you know how to do that ?

Thanks a lot.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 16, 2016, 8:25pm UTC](https://discuss.elastic.co/t/logstash-grok-and-translate/47503/2 "2016-04-16T20:25:48Z")

</div>

Try `%{myGrokPattern}` instead. But I am not so sure it will work anyway, as the grok filter will look for the pattern in it's library, not take it from the message.

---

<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:01am UTC](https://discuss.elastic.co/t/logstash-grok-and-translate/47503/3 "2017-07-06T05:01:57Z")

</div>


