Splunk Search

transaction startswith 1, endswith multiple

leea11
Engager

Hi all, simple question I hope.
I have a system that has one starting event with multiple outputs and I want to find out how long it takes for the system to produce each output. When I use a transaction, it only seems to give me the combination of the input and just one of the outputs, where I actually need all of the outputs.

transaction  activity_id startswith=input_event_name, endswith=output_event_name

Any ideas how I can include all the the outputs? Or is there a much better way to do this?

Many thanks

Tags (1)
0 Karma
1 Solution

wpreston
Motivator

How about using stats instead of transaction? Perhaps something like this:

... your search ... 
| eval StartTime=if(searchmatch("input_event_name"),_time,null()) 
| eval EndTime=if(searchmatch("output_event_name"),_time,null()) 
| stats values(StartTime) as StartTime values(EndTime) as EndTime by activity_id
| mvexpand EndTime
| eval TransactionTime=EndTime - StartTime 

This will give you the activity_id, start time, end time, and duration for every instance of output_event_name. If you need to see other information, just modify the stats statement to include it.

View solution in original post

wpreston
Motivator

How about using stats instead of transaction? Perhaps something like this:

... your search ... 
| eval StartTime=if(searchmatch("input_event_name"),_time,null()) 
| eval EndTime=if(searchmatch("output_event_name"),_time,null()) 
| stats values(StartTime) as StartTime values(EndTime) as EndTime by activity_id
| mvexpand EndTime
| eval TransactionTime=EndTime - StartTime 

This will give you the activity_id, start time, end time, and duration for every instance of output_event_name. If you need to see other information, just modify the stats statement to include it.

wpreston
Motivator

You're very welcome, happy to help!

0 Karma

leea11
Engager

A thousand thank yous wpreston, that worked a treat!

0 Karma

somesoni2
Revered Legend

Can you provide some sample logs?

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I don't know how to handle that situation in a transaction, but perhaps this will help.

input_event_name | join activity_id max=0 overwrite=false [ search output_event_name ] | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...