Splunk Search

Issue in combined field values?

anu41
Explorer

I am having issue with "Status" values as below and screenshot, please find below json and search query.

Please advise!! Appreciate your help!

  EventDate( 21/10/2022) EventDate( 20/10/2022)
Expected "Status" DOCUMENT_ERROR:2
DOCUMENT_REQUEST_RECEIVED:2
 
Actual "Status" DOCUMENT_REQUEST_RECEIVED:2 DOCUMENT_ERROR:2

 

|eval Status = mvzip('eventData{}.eventStatusCount{}.status', 'eventData{}.eventStatusCount{}.count', ":") | table "eventData{}.eventDate","eventData{}.ReceivedCount",
"eventData{}.ProcessedCount","eventData{}.MismatchCount","Status"
| rename eventData{}.eventDate as "EventDate",eventData{}.ReceivedCount as "Total Event Received Count", eventData{}.ProcessedCount as "Total Event Processed Count",
eventData{}.MismatchCount as "Total Event Mismatch Count"

 

"eventData": [
{
"eventDate": "2022-10-20",
"eventKey": "event.request",
"ProcessedCount": 0,
"eventStatusCount": [],
"ReceivedCount": 100,
"MismatchCount": 100
},
{
"eventDate": "2022-10-21",
"eventKey": "event.request",
"ProcessedCount": 2,
"eventStatusCount": [
{
"status": "DOCUMENT_ERROR",
"count": 2
},
{
"status": "DOCUMENT_REQUEST_RECEIVED",
"count": 2
}
],
"ReceivedCount": 1000,
"MismatchCount": 998
}
]

anu41_0-1668606742449.png

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

You need to separate the eventData collection into separate events with mvexpand

| spath eventData{} output=eventData
| mvexpand eventData
| spath input=eventData
|eval Status = mvzip('eventStatusCount{}.status', 'eventStatusCount{}.count', ":") | table "eventDate","ReceivedCount",
"ProcessedCount","MismatchCount","Status"
| rename eventDate as "EventDate",ReceivedCount as "Total Event Received Count", ProcessedCount as "Total Event Processed Count",
MismatchCount as "Total Event Mismatch Count"

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You need to separate the eventData collection into separate events with mvexpand

| spath eventData{} output=eventData
| mvexpand eventData
| spath input=eventData
|eval Status = mvzip('eventStatusCount{}.status', 'eventStatusCount{}.count', ":") | table "eventDate","ReceivedCount",
"ProcessedCount","MismatchCount","Status"
| rename eventDate as "EventDate",ReceivedCount as "Total Event Received Count", ProcessedCount as "Total Event Processed Count",
MismatchCount as "Total Event Mismatch Count"
0 Karma

anu41
Explorer

Thanks ITWhisperer !!!

The solution is working 

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...

Upgrade Prep for 10.4, Network Observability Deep Dives, and More from Splunk Lantern

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Splunk Developer Day announcements: AI agents, MCP tools, Forecasting, and Custom ...

Splunk Developer Day was packed with product and platform updates for developers building in the AI ...