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!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...