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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...