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!

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 ...