You should filter the list with that kind of pseudo code,
filter where start < DateTime.utc_now + 7 days, then use Enum.uniq_by…
first, this list should be transformed into something usable…
list
|> String.split("\n", trim: true)
|> Enum.map(fn x ->
String.split(x, " ")
end)
|> Enum.map(fn [a, b, c] ->
{:ok, dt, _} = DateTime.from_iso8601(b<>"T"<>c)
{a, dt}
end)
[
{"192.168.44.152", ~U[2021-12-16 12:44:11.822908Z]},
{"192.168.44.163", ~U[2021-12-16 12:44:11.822924Z]},
{"192.168.44.164", ~U[2021-12-16 12:44:11.822931Z]},
{"192.168.44.165", ~U[2021-12-16 12:44:11.822937Z]},
{"192.168.44.166", ~U[2021-12-16 12:44:11.822943Z]},
{"192.168.44.167", ~U[2021-12-16 12:44:11.822962Z]},
{"192.168.44.168", ~U[2021-12-16 12:44:11.822984Z]},
{"192.168.44.169", ~U[2021-12-16 12:44:11.822991Z]},
{"192.168.44.151", ~U[2021-12-16 12:44:11.823005Z]},
{"192.168.44.153", ~U[2021-12-16 12:44:11.823012Z]}
]
A list with ip first, then datetime…
Then, apply the pseudo code to get unique ip…
input
|> Enum.filter(...)
|> Enum.uniq_by(...)
|> Enum.map(&elem(&1, 0))
Then, create a ticking gen_server, which executes this code each hour.