Logstash Java hashSetting Syntax


We are currently in the process of writing a JAVA based logstash plugin
We can easily set custom properties in the logstash config and read them inside our class

But we cant get the maps to work

// public static final PluginConfigSpec<Map<String, Object>> CONFIG_CUSTOM_METADATA = PluginConfigSpec.hashSetting(PROPERTY_CUSTOM_METADATA, new HashMap<String, Object>(), false, false);

We have the following property in the pipeline.conf
customMetadata => {"https://biodiversity.europa.eu/":["BISE", "Biodiversity Information System Europe", "Biodiversity"]}

But its giving us an error that the json syntax is not correct.

What is the correct json syntax for maps ?

The full code is on github

Thank you

Hi Tom,

For map settings you need to use the usual "hash" notation used elsewhere in the logstash pipeline, with => instead of colons:

customMetadata => { "https://biodiversity.europa.eu/" => ["BISE", "Biodiversity Information System Europe", "Biodiversity"]}

That works great.

Thank you.

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