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 )
'
}
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 )
'
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us