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!

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Introducing the 2026 - 2027 SplunkTrust cohort!

The goal of the SplunkTrust™ membership has historically been to acknowledge and recognize those who go above ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...