Skip to main content


Showing posts from October, 2015

Logstash: Looping through nested JSON in ruby filter

Suppose we have a JSON payload (may be a stream coming from Kafka) that looks like this:
{"regionName":"asia","nodes":[{"node":"","weight":"0"},{"node":"","weight":"100"}]} {"regionName":"asia","nodes":[{"node":"","weight":"0"},{"node":"","weight":"0"},{"node":"","weight":"100"},{"node":"","weight":"100"}]} To loop through the nested fields and generate extra fields from the calculations while using Logstash, we can do something like this:
input { kafka { bootstrap_servers => "kafka.singhaiuklimi…