Splunk Search

How to calculate the time difference between request and response log entries?

vamsi199
Engager

I need to calculate time difference between two (request and response) entries in log

I have logs like below

Request : 23/11/2016 22:03:15,Host1,CheckStatusRequest, cb7319d4-a90f-4c2d-8f5b-5d0f2592fede
Response : 23/11/2016 22:03:17,Host1,CheckStatusResponse, cb7319d4-a90f-4c2d-8f5b-5d0f2592fede,  ResponseCode: SUCCESS

Thanks

0 Karma
1 Solution

HiroshiSatoh
Champion

You can calculate it using the transaction command.

When the field name is as follows
ex.
_time,host,CheckStatus,KeyCode,ResponseCode
23/11/2016 22:03:15,Host1,CheckStatusRequest, cb7319d4-a90f-4c2d-8f5b-5d0f2592fede
23/11/2016 22:03:17,Host1,CheckStatusResponse, cb7319d4-a90f-4c2d-8f5b-5d0f2592fede, ResponseCode: SUCCESS

your search| transaction host,KeyCode startswith="CheckStatusRequestSTART" endswith="CheckStatusResponse"|table host,key,duration

View solution in original post

HiroshiSatoh
Champion

You can calculate it using the transaction command.

When the field name is as follows
ex.
_time,host,CheckStatus,KeyCode,ResponseCode
23/11/2016 22:03:15,Host1,CheckStatusRequest, cb7319d4-a90f-4c2d-8f5b-5d0f2592fede
23/11/2016 22:03:17,Host1,CheckStatusResponse, cb7319d4-a90f-4c2d-8f5b-5d0f2592fede, ResponseCode: SUCCESS

your search| transaction host,KeyCode startswith="CheckStatusRequestSTART" endswith="CheckStatusResponse"|table host,key,duration

Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...