Splunk Search

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

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

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
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!