# Logstash Translate Plugin - Dynamic dictionary path

**URL:** <https://discuss.elastic.co/t/logstash-translate-plugin-dynamic-dictionary-path/185275>\
**Category:** Logstash\
**Created:** [June 11, 2019, 8:08pm UTC](https://discuss.elastic.co/t/logstash-translate-plugin-dynamic-dictionary-path/185275 "2019-06-11T20:08:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![myerasi](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@myerasi](https://discuss.elastic.co/u/myerasi)\
**Post date:** [June 11, 2019, 8:08pm UTC](https://discuss.elastic.co/t/logstash-translate-plugin-dynamic-dictionary-path/185275/1 "2019-06-11T20:08:31Z")

</div>

Hi all,

We have a use-case to populate dictionary path dynamically for the Logstash translate plugin. We have lookup files for each location and are ingesting data from more than 30 locations. So, we would like to auto-populate the dictionary\_path field based on the origin [in our case **location** field]. The sample code I tried is the following:

```auto
translate {
     field => "SG_ID"
     dictionary_path => "/etc/logstash/resources/%{[LOCATION]}_sgid_hub_mapping.csv"
     destination => "HUB"
}

```

When I try to use the aforementioned code, Logstash complains.  
**[ERROR][logstash.filters.translate] Invalid setting for translate filter plugin:**

The only alternative I can think of is writing a long parsing config by defining translate plugin code section for each of the 30 locations - which I am not inclined towards.

Any recommendation/suggestion in this regard will be of great help.

Thanks.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 11, 2019, 8:27pm UTC](https://discuss.elastic.co/t/logstash-translate-plugin-dynamic-dictionary-path/185275/2 "2019-06-11T20:27:44Z")

</div>

Yeah, translate does not sprintf the dictionary\_path field. translate just [passes it](https://github.com/logstash-plugins/logstash-filter-translate/blob/5e0705a6d92dc4d7fc128da8b4d1b9adf3dc7afe/lib/logstash/filters/translate.rb#L166) to [Dictionary::File](https://github.com/logstash-plugins/logstash-filter-translate/blob/5e0705a6d92dc4d7fc128da8b4d1b9adf3dc7afe/lib/logstash/filters/dictionary/file.rb#L66), which calls the appropriate [loader](https://github.com/logstash-plugins/logstash-filter-translate/blob/5e0705a6d92dc4d7fc128da8b4d1b9adf3dc7afe/lib/logstash/filters/dictionary/json_file.rb#L13). I do not understand the code base well enough to know whether that filter would have access to StringInterpolation.evaluate, so I cannot say whether it would be possible to fix that.

---

<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 9, 2019, 8:27pm UTC](https://discuss.elastic.co/t/logstash-translate-plugin-dynamic-dictionary-path/185275/3 "2019-07-09T20:27:47Z")

</div>

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