I have an issue with paths in my Splunk search. I am searching through JSON data where certains paths can have capitals, but also for a certain flow don’t have capitals. The fields are exactly the same, but the capitals of the fieldnames are the difference. How can I combine the paths (because as far as I know the paths are treated as two different paths by Splunk) to get one output and combine them in the count?
index="x"
| spath MessageTemplate | search MessageTemplate="Input Message: {Body}"
| spath input="Properties.Body"
| spath input="Properties.Body" path="voormelden{}.colloData{}.voormeldBronCd.code" output=VoormeldBronCode
| spath input="Properties.Body" path="voormelden{}.ColloData{}.VoormeldBronCd.Code"
output=VoormeldBronCode
| stats count by VoormeldBronCode
As you can see the paths for the body can be with capitals or with camelcase and I want to combine those in one output, so the count takes both of the versions (obviously this example doesn’t work).
2
Answers
I think you may need to normalize the data in one of two ways: change the field(s) of interest to always have the same name; or change all of
MessageTemplate
to lower case.or
Try this run-anywhere SPL, making use of coalesce: