Maybe it's as easy as adding it in the where clause: | mstats latest_time(application_ready_time.value) as latest_ts
WHERE
index=my-metrics-index
host=some-host
app.name IN ("appname1", "appname2")
BY app.name
| eval past_threshold=if(now() - latest_ts >= 30, "Y", "N")
| eval latest=strftime(latest_ts, "%Y-%m-%d %H:%M:%S")
| table app.name latest past_threshold x Give that a try. If it doesn't work, you can just post filter it with something like | mstats latest_time(application_ready_time.value) as latest_ts
where
index=my-metrics-index
host=some-host
by app.name
| search app.name IN ("appname1", "appname2")
| eval past_threshold=if(now() - latest_ts >= 30, "Y", "N")
| eval latest=strftime(latest_ts, "%Y-%m-%d %H:%M:%S")
| table app.name latest past_threshold x The former with the app.names as part of the WHERE clause is probably preferable. Splunk can often push these sorts of search terms down into the search itself, but I'm not sure if it does that with mstats. Meaning, if it CAN do that, it'll perform the same as the first one (more or less). But if it can't do that, it'll run quite a bit slower because it'll get all those stats off disk, then throw away all but the two sets you want to keep. But it would work, either way. 🙂
... View more