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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...