Splunk Search

Subtracting between two _time (And get result in days)

zacksoft
Contributor

My log contain some events that we call 'bonus_events'. And 'bonus_events' happen once or twice a week.
I am calculating delta(subtracting between two consecutive 'bonus_events') and getting the result in a weird format (i.e -25705.655 etc)
I want to get this weird format converted into 'days'. So that it should tell me "How many days back the last bonus_event happened?"

This is what I have written,
host="lak1200.ramana.com" source="/apps/games/prizes-*" bonus
| delta _time AS last_bonus_event p=1 | table last_bonus_event

Tags (1)
0 Karma
1 Solution

FrankVl
Ultra Champion

_time is populated with a unix epoch timestamp value. Which basically is a number of seconds since jan 1 1970. So if you subtract 2 _time values, you get a number of seconds. To translate that to days, simply divide by the number of seconds in a day (3600*24) 🙂

View solution in original post

0 Karma

FrankVl
Ultra Champion

_time is populated with a unix epoch timestamp value. Which basically is a number of seconds since jan 1 1970. So if you subtract 2 _time values, you get a number of seconds. To translate that to days, simply divide by the number of seconds in a day (3600*24) 🙂

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...