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!

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...