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!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...