Skip to content

ipInSubnet - Check if IP belongs to a given subnet

The ipInSubnet function will detect if an IP address belongs to a given subnet.

Syntax

ipInSubnet(ip: string, ipPrefix: string): bool

Arguments

NameTypeRequiredDescription
ipstringtrueThe IP address to test
ipPrefixstringtrueThe CIDR range to check against the IP address e.g 154.67.8.0/24

Example - Filter for IP addresses in a given range

filter can be coupled with ipInSubnet to perform complex searches with very little syntax:

filter ipInSubnet(ip_address, '154.67.8.0/24')

This will search for a field, ip_address, check if that ip_address is within the range 154.67.8.0/24. If it is, it is included in the results, otherwise it is excluded.