Splunk Search

Transaction command replies transaction duration for multiple start events and same stop event

zakyx88
New Member

Hi All,

I'm trying to figure out a query that can give me the transaction time of the earliest occurrence of the start event till the stop event to calculate the average transaction times.

For example:

12:00 - start event
12:01 - start event
12:02 - start event
12:03 - stop event
12:04 - start event
12:05 - start event
12:06 - start event
12:07 - start event
12:08 - stop event
12:09 - start event
12:10 - stop event

transaction startswith="start" endsswith="stop"

Out put is:
12:00 - start event
12:03 - stop event

-duration: 3
12:01 - start event
12:03 - stop event

-duration: 2
12:02 - start event
12:03 - stop event

-duration: 1
12:04 - start event
12:08 - stop event

-duration: 4
12:05 - start event
12:08 - stop event

-duration: 3
12:06 - start event
12:08 - stop event

-duration: 2
12:07 - start event
12:08 - stop event

-duration: 1
12:09 - start event
12:10 - stop event

-duration:1

The problem here is that it calculates for every start event till the next stop event the duration time... but I want only the first occurrence or the event with the longest duration:

12:00 - start event
12:03 - stop event

-duration: 3
12:04 - start event
12:08 - stop event

-duration: 4
12:09 - start event
12:10 - stop event

-duration:1

In this case, I don't want the "retry" events of my start event to be in the end result (they are logged with the same statements as the initial one). Can somebody provide some help on how to achieve this?

0 Karma

Richfez
SplunkTrust
SplunkTrust

I believe this works, if it does and it's good for you I can convert to an answer.

If you leave off the start=... parameter, it should do what you want.

transaction endswith="stop"

Can you try and see if that works better?

0 Karma
Get Updates on the Splunk Community!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...