Splunk Search

How to combine two raw events based on status?

moinyuso96
Path Finder

The raw data was uploaded from a .txt file. I managed to create the table as below.

rawTestFeatureNameStatusDateTimeStation
4015_ABCD, Start, 8/11/2020 5:37:10 PM, 123454015_ABCDStart8/11/2020 5:37:10 PM12345
4015_ABCD, Complete, 8/11/2020 5:37:30 PM, 123454015_ABCDComplete8/11/2020 5:37:30 PM12345

4015_ABCD, Start, 8/12/2020 10:23:34 AM, 12345

4015_ABCDStart8/12/2020 10:23:34 AM12345
1113_EFGH, Start, 8/12/2020 12:00:00 PM, 678901113_EFGHStart8/12/2020 12:00:00 PM67890
1113_EFGH, Complete, 8/12/2020 1:00:00 PM, 678901113_EFGHComplete8/12/2020 1:00:00 PM

67890

 

Are there any ways to combine two "raw" events based on the "status" field.

My expected result for "raw" field:

raw

4015_ABCD, Start, 8/11/2020 5:37:10 PM, 123454015_ABCD, Complete, 8/11/2020 5:37:30 PM, 12345

4015_ABCD, Start, 8/12/2020 10:23:34 AM, 12345

1113_EFGH, Start, 8/12/2020 12:00:00 PM, 678901113_EFGH, Complete, 8/12/2020 1:00:00 PM, 67890

Labels (2)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@moinyuso96 

Can you please try this?

YOUR_SEARCH
| sort - _time
| transaction TestFeatureName  startswith="Start"
| fields _raw

 

My Sample Search :

| makeresults | eval _raw="raw	TestFeatureName	Status	DateTime	Station
4015_ABCD, Start, 8/11/2020 5:37:10 PM, 12345	4015_ABCD	Start	8/11/2020 5:37:10 PM	12345
4015_ABCD, Complete, 8/11/2020 5:37:30 PM, 12345	4015_ABCD	Complete	8/11/2020 5:37:30 PM	12345
4015_ABCD, Start, 8/12/2020 10:23:34 AM, 12345	4015_ABCD	Start	8/12/2020 10:23:34 AM	12345
1113_EFGH, Start, 8/12/2020 12:00:00 PM, 67890	1113_EFGH	Start	8/12/2020 12:00:00 PM	67890
1113_EFGH, Complete, 8/12/2020 1:00:00 PM, 67890	1113_EFGH	Complete	8/12/2020 1:00:00 PM	67890" | multikv forceheader=1
| table _time raw	TestFeatureName	Status	DateTime	Station
| rename raw as _raw
| eval t = 100 | accum t | eval _time = _time + t
| sort - _time
| transaction TestFeatureName  startswith="Start"
| fields _raw


 Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

View solution in original post

kamlesh_vaghela
SplunkTrust
SplunkTrust

@moinyuso96 

Can you please try this?

YOUR_SEARCH
| sort - _time
| transaction TestFeatureName  startswith="Start"
| fields _raw

 

My Sample Search :

| makeresults | eval _raw="raw	TestFeatureName	Status	DateTime	Station
4015_ABCD, Start, 8/11/2020 5:37:10 PM, 12345	4015_ABCD	Start	8/11/2020 5:37:10 PM	12345
4015_ABCD, Complete, 8/11/2020 5:37:30 PM, 12345	4015_ABCD	Complete	8/11/2020 5:37:30 PM	12345
4015_ABCD, Start, 8/12/2020 10:23:34 AM, 12345	4015_ABCD	Start	8/12/2020 10:23:34 AM	12345
1113_EFGH, Start, 8/12/2020 12:00:00 PM, 67890	1113_EFGH	Start	8/12/2020 12:00:00 PM	67890
1113_EFGH, Complete, 8/12/2020 1:00:00 PM, 67890	1113_EFGH	Complete	8/12/2020 1:00:00 PM	67890" | multikv forceheader=1
| table _time raw	TestFeatureName	Status	DateTime	Station
| rename raw as _raw
| eval t = 100 | accum t | eval _time = _time + t
| sort - _time
| transaction TestFeatureName  startswith="Start"
| fields _raw


 Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

aasabatini
Motivator

Hi @moinyuso96 

you can try with transaction command but be careful because is too heavy

https://docs.splunk.com/Documentation/Splunk/8.2.0/SearchReference/Transaction

Regards

Ale

“The answer is out there, Neo, and it’s looking for you, and it will find you if you want it to.”

moinyuso96
Path Finder

@aasabatini What do you mean by heavy? Will it affect the performance? Because I actually have to run thousands of these text files. 

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

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...