Splunk Search

Is there a conversion function for time modifiers?

johnraftery
Communicator

Hi, I'm using a time picker which gives you a start and end token as time modifiers (eg "-2d@d - now" for the last two days). See http://docs.splunk.com/Documentation/Splunk/6.3.3/Search/Specifytimemodifiersinyoursearch

Is there a function to convert the time modifier into an absolute time (ie 1456312200 - 1456482900)? I know I can put the time modifiers into the earliest and latest tags of my query, but I'm actually querying a lookup table so there is no _time field to base it on; I need to restrict the time in the query itself.

Thanks,
John

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Try the relative_time() function. For example,

... | eval absTime = relative_time(now(), $start$) | ...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Try the relative_time() function. For example,

... | eval absTime = relative_time(now(), $start$) | ...
---
If this reply helps you, Karma would be appreciated.

johnraftery
Communicator

That's the one, thanks!

0 Karma

javiergn
SplunkTrust
SplunkTrust

Hi,

Sorry I'm not too sure what you are referring to.
Please take a look at the relative_time() function and let me know if that's what you are looking:

http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/Commonevalfunctions#Date_and_Time_...

johnraftery
Communicator

That's the one, thanks!

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