Excerpt |
---|
Computes an integer value for a four-octet internet protocol (IP) address. Source value must be a valid IP address or a column reference to IP addresses. |
IP addresses must be in the following format:
Code Block |
---|
aaa.bbb.ccc.ddd |
where aaa
, bbb
, ccc
, and ddd
, are integers 0 - 255, inclusive.
Info |
---|
NOTE: IPv6 addresses are not supported. |
The formula used to compute the integer equivalent of the above IP address is the following:
(aaa * 2563) + (bbb * 2562) + (ccc * 256) + (ddd)
As a result, each valid IP address has a unique integer equivalent.
Numeric literal example:
D lang syntax |
---|
RawWrangle | true |
---|
Type | ref |
---|
showNote | true |
---|
WrangleText | derive type:single value: iptoint('1.2.3.4' ) as:'myAddress' |
---|
|
iptoint('1.2.3.4' ) |
Output: Returns the integer value 16909060.
Column reference example:
D lang syntax |
---|
RawWrangle | true |
---|
Type | ref |
---|
showNote | true |
---|
WrangleText | derive type:single value: iptoint(IpAddr) as: 'ip_as_int' |
---|
|
iptoint(IpAddr) |
Output: Returns the value of the IpAddr
column converted to an integer value.
D lang syntax |
---|
RawWrangle | true |
---|
Type | syntax |
---|
showNote | true |
---|
WrangleText | derive type:single value: iptoint(column_ipaddr) |
---|
|
iptoint(column_ipaddr) |
Argument | Required? | Data Type | Description |
---|
column_ipaddr | Y | string | Column name or string literal identifying the IP address to convert to an integer value |
column_ipaddr
Name of the column or IP address literal whose values are used to compute the equivalent integer value.
- Missing input values generate missing results.
- Multiple columns and wildcards are not supported.
Required? | Data Type | Example Value |
---|
Yes | String literal or column reference (IP address) | 4.3.2.1 |
Example - Convert IP addresses to integers
Include Page |
---|
| EXAMPLE - IPTOINT Function |
---|
| EXAMPLE - IPTOINT Function |
---|
|