Hi @aljohnson!
I really appreciate the breakdown for this search...helped to understand what's happening. THANK YOU!
So, here is the search I ran....
index=forescout sourcetype="fs_av_compliance"
| eval non_compliant=if(status="non-compliant",1,0) | bin _time span=1d
| stats max(non_compliant) as non_compliant by _time src_nt_host src_ip status description
| eval time_chunk = case(
_time > relative_time(now(), "-90d"), "90days+",
_time > relative_time(now(), "-60d"), "60days+",
_time > relative_time(now(), "-30d"), "30days+")
| eval non_compliant_time = if(non_compliant==1, _time, null())
| stats
sum(non_compliant) as total_violations
min(non_compliant_time) as earliest_violation_time by src_nt_host, time_chunk
| eval earliest_violation_time = strftime(earliest_violation_time, "%F %T") | search total_violations>0
Out of ~2.5m events, 4.5k are returned as having total_violations>0.
Here are my questions as I went through adding each piped criteria to the search....
|eval time_chunk.... We are looking for ANY 30, 60, or 90 day span, not necessarily from "relative_time(now())", given that the latest status of the host is "non-compliant".
|eval non_compliant_time.... Is the result for non_compliant_time in seconds? How do I turn that into days so I can validate whether or not it's meeting the time_chunk criteria?
The time_chunk value for all returning records is set to 90days+, which doesn't seem right for all hosts where total_violations>0.
To answer the question of "first time being seen by the system", I meant, the first time the host was added to Forescout.
Thanks again for your help @aljohnson!
... View more