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!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Catalog Is Now Generally Available on Splunk Cloud Platform

A Unified View of Your Data  Security logs, application events, business data, and historical telemetry often ...

Your Path to AgenticOps: AI Experiences for Every Splunk Practitioner

Your Path to AgenticOps: AI Experiences for Every Splunk Practitioner   Watch on demand us for a demo-driven ...