The query below works, but i need to add a lookup value 'interval' to compare against the 'hours since last seen' values..
the lookup im adding is sourcetype_interval.csv which has two columns (sourcetype & interval)
| tstats latest(_indextime) as Latest where index=* by host sourcetype index
| `remove_blacklisted_servers()`
| search NOT [inputlookup sourcetype_blacklist.csv | table sourcetype]
| eval current=now()
| eval Minimum_Age=round(((current-Latest)/60)/60,2)
| rangemap field=Minimum_Age default=Critical Normal=0-0.5 Elevated=0.5-2 Warning=2-3
| eval stIDX=tostring(index) + " -- " + tostring(sourcetype)
| stats values(stIDX) as "Index -- Sourcetype" list(Latest) as "Latest Event" list(Minimum_Age) as Minimum_Age list(range) as Threshold by host
| convert ctime("Latest Event") timeformat="%Y/%m/%d %H:%M"
| eventstats avg(Minimum_Age) as average by host
| eval average=round(average,2)
| eval threshold_filter=mvfilter(NOT match(Threshold,"Normal") AND NOT match(Threshold,"Warning") AND NOT match(Threshold,"Elevated"))
| rename Minimum_Age as "Hours Since Last Seen" average as "Avg Hours Since Last Seen"
| fields - "Avg Hours Since Last Seen" threshold_filter
===================================================================================================
Here is how I was trying to to do it, bu to no avail. Thanks
| tstats latest(_indextime) as Latest where index=* by host sourcetype index
| `remove_blacklisted_servers()`
| search NOT [inputlookup sourcetype_blacklist.csv | table sourcetype]
| join sourcetype [|inputlookup sourcetype_interval.csv | table sourcetype interval]
| eval interval=round(interval/60/60,2)
| eval current=now()
| eval Minimum_Age=round(((current-Latest)/60)/60,2)
| rangemap field=Minimum_Age default=Critical Normal=0-0.5 Elevated=0.5-2 Warning=2-3
| eval stIDX=tostring(index) + " -- " + tostring(sourcetype)
| stats values(stIDX) as Index--Sourcetype list(Latest) as "Latest Event" list(Minimum_Age) as Minimum_Age list(range) as Threshold by host
| convert ctime("Latest Event") timeformat="%Y/%m/%d %H:%M"
| eventstats avg(Minimum_Age) as average by host
| eval average=round(average,2)
| eval threshold_filter=mvfilter(NOT match(Threshold,"Normal") AND NOT match(Threshold,"Warning") AND NOT match(Threshold,"Elevated"))
| where average > interval
| rename Minimum_Age as "Hours Since Last Seen" average as "Avg Hours Since Last Seen"
| fields - "Avg Hours Since Last Seen" threshold_filter
... View more