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!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...