sum all fields in nested json logstash code example
Example: sum all fields in nested json logstash
ruby { code => '
i = 0
sum = 0
while i < event.get( "[foo][bar][faz]" ).length do
sum += event.get( "[foo][bar][faz][" + i.to_s + "][[baz]]" )
i += 1
end
event.set( "sum", sum )
'
}