Dashboards & Visualizations

Single value last time yes or no

mmoermans
Path Finder

I'm trying to show a simple Yes (green) / No (red) on a dashboard based on a host not reporting for longer than 5 minutes. Seems to be a bit harder than I expected. What I've got:

index=index host=host
| stats latest(_time) as last_seen | eval duration_since = tostring(now() - last_seen, "duration") | eval stringtime=if(duration > "00:05:00", "Yes", "No") | table stringtime

But this shows "No" at all times, even though the host reported 1 second ago. What am I doing wrong?

Tags (1)
0 Karma

elliotproebstel
Champion

I don't think Splunk can compare time strings like that. Try this:

index=index host=host 
| stats latest(_time) as last_seen 
| eval stringtime=if(relative_time(now(), "-5m")>last_seen, "No", "Yes") 
| table stringtime
0 Karma

somesoni2
Revered Legend

I would avoid string comparison (in your if statement).

index=index host=host
 | stats latest(_time) as last_seen | eval duration_since = now() - last_seen | eval stringtime=if(duration >300, "Yes", "No") | table stringtime
0 Karma
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 ...