Is Public IPv4 (ispublic)
Description
You can apply this operation either as a Filter or Create column operation:
Filter | Returns only the public IP addresses of a selected ip column. |
---|---|
Create column | Creates a Boolean column that shows true if a given IP address is public. |
Public addresses range from 1 to 191, excluding the following blocks, which are reserved 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 Public IPv4 operation. You need to specify one argument:
Argument | Data type |
---|---|
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).
Example
In the demo.ecommerce.data
table, we want to get only the events where the IP addresses in the clientIpAddress column are public. To do it, we will apply a Filter using the Is public IPv4 operation.
The arguments needed for the filter are:
IP to test - clientIpAddress column
Click Filter data and you will see the following result:
To add a new Boolean column that shows true when the IP addresses in the clientIpAddress column are public, click Create column and follow the same steps.
How does it work in LINQ?
Use the operator where
... to apply the Filter operation and select
... as
... to apply the Create column operation. This is the syntax for the Is Public IPv4 operation:
ispublic(ip)
Examples
You can copy the following LINQ script and try the above example on the demo.ecommerce.data
table:
from demo.ecommerce.data
where ispublic(clientIpAddress)
And this is the same example using the Create column operation:
from demo.ecommerce.data
select ispublic(clientIpAddress) as public_ips