Splunk Search

last(count) pick older value. Is there any way to block thi behaviour?

fedevietti
New Member

Deal Splunkers,

I'm doing a serach like this to valorize a SingleValue indicator with range:

<my search> | eval secondsElapsedToday = now()-relative_time(now(), "@d") | eval _time=_time-secondsElapsedToday | bucket _time span=1d | stats count by _time | stats last(count) as today_count avg(count) as avg_count | eval range = case(today_count<avg_count, "low", today_count=avg_count, "elevated", today_count>=avg_count, "severe")

The problem is that if in the last day there aren't events the indicator show the last picked value. Is there any way to say that if in the last day value is absent the search have not to pick the earlier value?

thank you

Tags (1)
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

Probably you need to insert ... stats count by _time | eval count=coalesce(count,0) | stats last(count) as today_count ...

0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...