Splunk Enterprise Security

How to narrow time frame for metadata search to only see events within a certain window?

tromero3
Path Finder

I have a metadata search to detect when host stops sending logs. I'd like to change the timeframe so that I only see the hosts where Last_Time_Reported is between 1 - 90 days ago, I do not want to see anything if last time reported was beyond that. When I change the time picker to 90 days, I am still seeing events way past 90 days prior. So I know that I need to change the query instead but I am not sure what exactly I should add. Can someone please help? Thank you!

| metadata type=hosts index=* | where relative_time(now(), "-1d") > lastTime | convert ctime(lastTime) as Latest_Time | sort -lastTime | table host,Latest_Time | lookup assets.csv nt_host AS host OUTPUTNEW priority AS priority,bunit AS bunit | rename Latest_Time AS "Last Time Reported"

0 Karma
1 Solution

to4kawa
Ultra Champion
| where relative_time(now(), "-1d") > lastTime AND  lastTime > relative_time(now(), "-90d")  

the hosts where Last_Time_Reported is between 1 - 90 days ago
try this where

View solution in original post

0 Karma

to4kawa
Ultra Champion
| where relative_time(now(), "-1d") > lastTime AND  lastTime > relative_time(now(), "-90d")  

the hosts where Last_Time_Reported is between 1 - 90 days ago
try this where

0 Karma

tromero3
Path Finder

That worked! Thank you!!

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...