Splunk Search

How to get time duration between consecutive events in the same search results?

gsingal
Engager

In my logs, I have some events like:
time1 eventStart
time2 eventFinish
time3 eventStart
time4 eventFinish
time5 eventStart
time6 eventFinish

I want to get the time difference between start and finish event.
So, the result should be 3 rows, having time diff between: time2-time1, time4-time3, time6-time5

Can you please help?

Tags (3)
0 Karma

ckdoan
New Member

Hi, were you able to figure this out?

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Can you provide us your query and some sample data?

You need to group the events together using the Transaction command.. So if you have your eventStart as a seperate event from your eventFinish then the transaction command will group them both as 1 event then you can find the duration

So it would look something like this

.. | transaction startswith="eventStart" endswith="eventFinish" | timechart avg(duration)

0 Karma

bmacias84
Champion

Look at using transaction command

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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