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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...