Splunk Search

How to extract key value pair from string?

Mofizul
Loves-to-Learn Lots

Have a search result as

GET https://…. | Status: 403 | Message: Forbidden | Duration: 166 | x-req-id: ssv5s-ssy67-78vshb | x-correlation-id: vsvsuj-75sys7-sbbjs7

 

Need to extract value of x-req-id .

 

Tried this extract pairdelim="|" , kvdelim=":" ,which gives Status & Message & Duration but not able to fetch  x-req-id

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This works for me - which version of splunk are you using?

| makeresults
| eval _raw="GET https://…. | Status: 403 | Message: Forbidden | Duration: 166 | x-req-id: ssv5s-ssy67-78vshb | x-correlation-id: vsvsuj-75sys7-sbbjs7"
| extract pairdelim="|" kvdelim=":"
0 Karma

Mofizul
Loves-to-Learn Lots

Splunk 8.2.2.1

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Same here - so does my run anywhere example work for you?

0 Karma

Mofizul
Loves-to-Learn Lots

No its not working

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Do you get any errors reported which might help determine what the issue might be other than "its not working"?

0 Karma
Get Updates on the Splunk Community!

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...