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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...