Splunk Search

Combine 2 or more strings based on a comman field

batham
Explorer

Hi I am tracking service requests and responses and trying to create a table that contains both requests and response but requests and responses are in different lines ingested in splunk.

I have a common field (trace) which is available in both the strings and unique for a set of request and response pairs,

 example

line1: trace: 12345 , Request Received: {1}, URL:http://

line2: trace: 12346 , Request Received: {2}, URL:http://

line3: trace:12345 , Reponse provided: {3}

line4: trace:12346 , Reponse provided :{4}

 

In line1 and line 3 trace is common field and so is in line 1 and line 4

I want end result like in a table

 

trace      request     response

12345   {1}            {3}

12346  {2}            {4}

 

Labels (1)
Tags (1)
0 Karma
1 Solution

batham
Explorer

Inner join actually worked for this.

View solution in original post

0 Karma

batham
Explorer

Inner join actually worked for this.

0 Karma

yuanliu
SplunkTrust
SplunkTrust

If those lines are the only text in raw data, you can do

 

| extract pairdelim="," kvdelim=":"
| fields - _raw
| stats values(Request_Received) as request values(Response_provided) as response by trace

 

The result is

traceresponserequest
12345{3}{1}
12346{4}{2}

 

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Modern way of developing distributed application using OTel

Recently, I had the opportunity to work on a complex microservice using Spring boot and Quarkus to develop a ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had 3 releases of new security content via the Enterprise Security ...

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...