Is Private IPv4 (isprivate)
You can apply this operation either as a Filter or Create column operation:
Returns only the private IP addresses of a selected ip column.
Creates a Boolean column that shows true if a given IP address is private.
IP addresses in the following blocks are considered as private:
- 10.0.0.0 to 10.255.255.255
- 172.16.0.0 to 172.31.255.255
- 192.168.0.0 to 192.168.255.255
How does it work in the search window?
Select Filter / Create column in the search window toolbar, then select the Is Private IPv4 operation. You need to specify one argument:
|IP to test (mandatory)||ip|
If you use the Create column operation, the data type of the values in the new column is boolean (true or false).
demo.ecommerce.data table, we want to get only the events where the IP addresses in the clientIpAddress column are private. To do it, we will apply a Filter using the Is private IPv4 operation.
The arguments needed for the filter are:
- IP to test → clientIpAddress column
Click Filter data. Since there is no private IP addresses in the clientIpAddress column, you will see the following result:
To add a new Boolean column that shows true when the IP addresses in the clientIpAddress column are private, click Create column and follow the same steps. In this example, you will only get false values.
How does it work in LINQ?
Use the operator
where... to apply the Filter operation and
as... to apply the Create column operation. This is the syntax for the Is Private IPv4 operation:
You can copy the following LINQ script and try the above example on the
from demo.ecommerce.data where isprivate(clientIpAddress)
And this is the same example using the Create column operation:
from demo.ecommerce.data select iprivate(clientIpAddress) as private_ips