The eval statement is wrong, technically it would be | eval is_historical=if(in(ipAddress,
[
search index=<index> operationName="Sign-in activity" earliest=-7d@d
| stats values(ipAddress) as ...
See more...
The eval statement is wrong, technically it would be | eval is_historical=if(in(ipAddress,
[
search index=<index> operationName="Sign-in activity" earliest=-7d@d
| stats values(ipAddress) as ipAddress
| eval ipAddress="\"".mvjoin(ipAddress, "\",\"")."\""
| return $ipAddress
]
), "true", "false" ) but this is probably the wrong way to go about this, because you are always doing 2 searches, when you only need one. You should do a single search, for example like this index=<index> operationName="Sign-in activity" earliest=-7d@d
| bin _time span=1d
``` Count by day/ip ```
| stats count by _time ipAddress
``` Count unique days and most recent day by IP ```
| stats dc(_time) as countDays max(_time) as latestDay by ipAddress
``` Now calculate historical indicator ```
| eval is_historical=if(countDays>1 AND latestDay>=relative_time(now(), "@d"), "true", "false" )