now - Get the current time as a timestamp
The now
function gets the current time at query execution time. This has some important features:
now
will return a nonsecond timestamp, if the runtime supports it. Otherwise, it usesmillisecond
.now
is consistent no matter where it is invoked in the query, even multiple invocations.
Syntax
Example - Basic usage
Using now
is a simple function without any arguments:
Example - Time since log generation
It is sometimes useful to know exactly how long it has been since a log was written. This can be done using now
:
This will create a field time_since_write
which is of type interval
.
Theme
Light