Hello, My Splunk query an API and gets a JSON answer. Here is a sample for 1 Host (the JSON answer is very long ≈ 400 hosts) : { "hosts": [ { "hostInfo": { "displayName": "host1.fr" }, "modules": [ { "moduleType": "JAVA", "instances": [ { "Instance Name": "Test1", "moduleVersion": "1.0" }, { "Instance Name": "Test2", "moduleVersion": "1.1" }, { "Instance Name": "Test3", "moduleVersion": "1.2" } ] } ] } ] } First-of-all I have to manually parse this JSON because SPLUNK automatically gets the 1st fields of the 1st host only. With this following search, I manually parse this JSON all the way through the "instances{}" array and I count the number of moduleVersion : index="supervision_software" source="API" earliest=-1m | spath path=hosts{}.modules{}.instances{} output=host | fields - _raw | mvexpand host | spath input=host | stats count(moduleVersion) It displays a number of 1277 moduleVersion and it is the right number. On the other hand with the next similar search, when I parse the JSON starting only to the 1st array ("hosts{}"), I am getting a different number of moduleVersion : index="supervision_software" source="API" earliest=-1m | spath path=hosts{} output=host | fields - _raw | mvexpand host | spath input=host | stats count(modules{}.instances{}.moduleVersion) It displays a number of 488 moduleVersion but it's incorrect. Why is there a difference ? Thank you. Best regards,
... View more