Getting Data In

How to search the average time between two timestamps?

vrmandadi
Builder

Hello,

I am trying to find the difference between two time stamps using the below search:

index=abc | eval average_response_time = strptime(response, "%d-%m-%Y T%H:%M:%S.%3N") - strptime(request, "%d-%m-%Y T%H:%M:%S.%3N") 

I have attached the screen shot of it which has request and response..I want to calculate the time difference between them.

Thanks in advance

0 Karma
1 Solution

somesoni2
Revered Legend

The timeformat should be "%d-%b-%Y %H:%M:%S.%3N"

View solution in original post

woodcock
Esteemed Legend

Try ending like this instead:

... | eval average_response_time = tostring((strptime(response, "%d-%b-%Y %H:%M:%S.%3N") - strptime(request, "%d-%b-%Y %H:%M:%S.%3N") ), "duration")
0 Karma

somesoni2
Revered Legend

The timeformat should be "%d-%b-%Y %H:%M:%S.%3N"

vrmandadi
Builder

thanks Somesh

0 Karma
Get Updates on the Splunk Community!

What's New in Splunk Cloud Platform 9.3.2411?

Hey Splunky People! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2411. This release ...

Buttercup Games: Further Dashboarding Techniques (Part 6)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...