Splunk Search

How to make eval now() takes latest time filter?

jamin358
Explorer

I have a search that makes a decision based on time since an event. 

 

| eval diff = now() - _time

 

and then make some decision based on how long ago the event took place

 

| eval state = if(diff<300, "active", "not active")

 

However, if I want to run this historically, my diffs are set to current time so I can't easily look historically at a point in time and tell the state of the world (with the same search). 

Is there a time function in search where I can pull the earliest and latest time filters?

eg

 

| eval diff = $timerange.latest$ - _time 

 

Labels (1)
Tags (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| addinfo
| eval diff = info_max_time - _time

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| addinfo
| eval diff = info_max_time - _time
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...