Splunk Search

Any use cases on time commands in splunk SPL....?

prakash007
Builder

Can anyone explain the time commands in Splunk with a use case? I see few of these searches in Splunk Answers, but I understood only bits and pieces of them when used in searches...

_time
time()
now()
relative_time()
info_min_time()
info_max_time()
strptime()
strftime()
Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

You've mixed functions and fields.

_time is a field that says when an event happened.
info_min_time and info_max_time are fields added by the addinfo command. These fields are the lower and upper bounds of the search. They can be used to define the time period of a report, for instance.

The now() and time() functions both return the current time of day. time() includes microseconds whereas now() is the time in seconds. Both can be used in calculations to determine how old an event is.
The strptime() function converts a timestamp string ("2016-06-05", for example) into epoch (integer) form. This is the only way to do calculations with times.
The strftime() function is the inverse of strptime(). It converts a timestamp from epoch form into a human-readable string.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

You've mixed functions and fields.

_time is a field that says when an event happened.
info_min_time and info_max_time are fields added by the addinfo command. These fields are the lower and upper bounds of the search. They can be used to define the time period of a report, for instance.

The now() and time() functions both return the current time of day. time() includes microseconds whereas now() is the time in seconds. Both can be used in calculations to determine how old an event is.
The strptime() function converts a timestamp string ("2016-06-05", for example) into epoch (integer) form. This is the only way to do calculations with times.
The strftime() function is the inverse of strptime(). It converts a timestamp from epoch form into a human-readable string.

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...