I doubt if Splunk has truly extracted JSON array content.payload{}. As you observed, Splunk gives you a flattened structure of the array. As @gcusello said, spath is the right tool. The syntax is ...
See more...
I doubt if Splunk has truly extracted JSON array content.payload{}. As you observed, Splunk gives you a flattened structure of the array. As @gcusello said, spath is the right tool. The syntax is | spath content.payload{}
| mvexpand content.payload{} Normally, you can then continue to use spath to extract content.payload{} after this. But your data has another layer of array. That's not usually a problem. But then, your developers did you a great injustice by using actual data values (e.g., "GL Import flow processing results") as JSON key. Not only is this data, but the key name included major SPL breakers. I haven't found a method to use spath to handle this. If you have any influence over your developers, insist that they change "GL Import flow processing results" to a value and assign it an appropriate key such as "workflow". Otherwise, your trouble will be endless. Luckily, Splunk introduced from_json in 9.0. If you use 9+, you can work around this temporarily before your developers take action. | spath path=content.payload{}
| mvexpand content.payload{}
| fromjson content.payload{}
| mvexpand "GL Import flow processing results" You sample data should give you GL Import flow processing results content.payload{} {"concurBatchId":"4","batchId":"6","count":"50","impConReqId":"1","errorMessage":null,"filename":"CONCUR_GL.csv"} { "GL Import flow processing results" : [ { "concurBatchId" : "4", "batchId" : "6", "count" : "50", "impConReqId" : "1", "errorMessage" : null, "filename" : "CONCUR_GL.csv" } ] } AP Import flow related results : Extract has no AP records to Import into Oracle (Scroll right to see other columns.) This is an emulation for you to play with and compare with real data | makeresults
| eval _raw = "{
\"content\" : {
\"jobName\" : \"AP2\",
\"region\" : \"NA\",
\"payload\" : [ {
\"GL Import flow processing results\" : [ {
\"concurBatchId\" : \"4\",
\"batchId\" : \"6\",
\"count\" : \"50\",
\"impConReqId\" : \"1\",
\"errorMessage\" : null,
\"filename\" : \"CONCUR_GL.csv\"
} ]
}, \"AP Import flow related results : Extract has no AP records to Import into Oracle\" ]
}
}"
``` data emulation above ```