Splunk Search

How to search time difference?

aaa2324
Explorer

I have 2 values  time received =161300 and time sent = 161259, and I want to get the time stamp difference which is 1.

diff time received- time sent gives 41 sec which is incorrect.

please help with the correct query. 
the data given above is in hhmmss format 

Labels (1)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Splunk treats those two fields as integers so the difference between them is indeed 41.  If the fields are really strings then you first have to convert them into integers.

... | eval recv = strptime(time_received, "%H%M%S"), sent = strptime(time_sent, "%H%M%S")
| eval diff = recv - sent
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...