Splunk Search

spath outputs wrong percentage for fields in inner jsons

electronicsplun
New Member

Hi

It look like spath calculates its percentage based on the number of available events instead on the number of occurrences of the checked value. For example if I have the next event (did not include the metadata):

{"test": [{"t": 1}, {"t": 2}, {"t": 2}]}

spath will say that the interesting field test{}.t consists of 2 values and that the value 2 appears in 200% of events (value 1 appears in 100%). This is a very confusing, why not check it against the number of the occurrences of test{}.t (Perhaps there is a way to do it and I missed it).

0 Karma

to4kawa
Ultra Champion
| makeresults 
| eval _raw="{\"test\": [{\"t\": 1}, {\"t\": 2}, {\"t\": 2}]}"
| spath
| stats count by test{}.t

HI, @electronicsplunk
How about this?

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...