Logstash Translate Plugin - Dynamic dictionary path

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:

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.

Yeah, translate does not sprintf the dictionary_path field. translate just passes it to Dictionary::File, which calls the appropriate loader. 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.

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