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!

3 Ways to Make OpenTelemetry Even Better

My role as an Observability Specialist at Splunk provides me with the opportunity to work with customers of ...

What's New in Splunk Cloud Platform 9.2.2406?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2406 with many ...

Enterprise Security Content Update (ESCU) | New Releases

In August, the Splunk Threat Research Team had 3 releases of new security content via the Enterprise Security ...