Logstash: Accessing the environment variable from rule config file through "dynamic key" reference

We have an requirement to read environment variable from rule config file through dynamic key reference instead of static key reference.
However, It seems Logstash does not support reading Environment variable through dynamically rendered key i.e. in our code we need to access environment variable: IP_Source HOST IP_TYPE.
Here "Source HOST IP" is dynamically initialized field on the basis of source of log message.
Dynamic key Code: ${IP_%hostip_TYPE}
Static key Code: ${IP_10_13_204_11_TYPE}

With static key it is able to fetch but with dynamically initialized key it failed to read from environment.

Please guide on the resolution of this issue

The syntax would have to be ${IP_%{hostip_TYPE}} but I'm pretty sure that doesn't work. You should be able to accomplish what you want with a ruby filter.

Tried this but does not work. I believe there is no support in Logstash for this.

Tried what, a ruby filter? That'll definitely work.

Sure will try Ruby filter

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