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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...