Splunk Search

What is the difference between now() and _time?

smanojkumar
Communicator

What is the difference between now() and _time?

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @smanojkumar,

_time is the timestamp of each event and it's usually extracted from the raw event.

now() is a function, it's usully used in eval statements, that returns the date and time when the search runs.

So they give you different information in the same format (epochtime).

Ciao.

Giuseppe

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

now() is in seconds, but there is a function time() which is in my environment goes to microseconds - _time as used by makeresults is usually the same as now()

| makeresults
| eval now=now()
| eval time=time()
| fieldformat now=strftime(now,"%F %T.%9N")
| fieldformat time=strftime(time,"%F %T.%9N")
| fieldformat _time=strftime(_time,"%F %T.%9N")

gcusello
SplunkTrust
SplunkTrust

Hi @smanojkumar,

_time is the timestamp of each event and it's usually extracted from the raw event.

now() is a function, it's usully used in eval statements, that returns the date and time when the search runs.

So they give you different information in the same format (epochtime).

Ciao.

Giuseppe

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