Groups by IP with regex generator?

Hello guys.

I have read several old posts from 2017 and 2018 on the same topic, with no luck.
Since i don’t know regex, i found this tool.

Which sounded promising. But in really cant get any filter to work.
Does filtering by IP actually work? found a post saying it was finicky .

I trying ipv4_addresses.ipv4_address REGEXP “^10.169.8.(1[7-9]|2[0-9]|30)$”
but nothing shows up.

all pointers and suggestions are greatly appreciated
thanks

One reason it’s finicky because the ipv4_addresses tables is related to ports. It doesn’t directly tie to the devices tables. Behind the scenes, your group query is running something like this…

SELECT * FROM devices,ports,ipv4_addresses WHERE (devices.device_id = ports.device_id AND ports.port_id = ipv4_addresses.port_id) AND ipv4_addresses.ipv4_address REGEXP "^10.169.8.(1[7-9]|2[0-9]|30)$"

So it can only really work if your device has port with an IP address in that range.

It works as expected for me - but yes IPs are finicky to match.

This works for example and get me 4 hosts - 5-6 and 10-11

Are the IPs you are searching for actually there, or are they actually hostnames (devices.hostname) or overwrite IPs (devices.overwrite_ip)? Can you find them via /search/search=ipv4 (Overview → IPv4 Address).

That said, I don’t generally use regex, I tend to use a combination of ipv4_address begins with 10.10.10 and ip4v_prefixlen = to approximate it and lean heavily on my host naming sanity to help group things instead - which is never quite as granular.

1 Like

I appreciate the tips, there were listed under hostnames! Thanks!!!