Answers for "sum all fields in nested json logstash"

0

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 ) 
 '
}
Posted by: Guest on July-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language