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!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...