Contribute in GitHub:
Edit online
parse_ipv6()
Converts IPv6 or IPv4 string to a canonical IPv6 string representation.
parse_ipv6("127.0.0.1") == '0000:0000:0000:0000:0000:ffff:7f00:0001'
parse_ipv6(":fe80::85d:e82c:9446:7994") == 'fe80:0000:0000:0000:085d:e82c:9446:7994'
Syntax
parse_ipv6(
Expr
)
Arguments
Expr
: String expression representing IPv6/IPv4 network address that will be converted to canonical IPv6 representation. String may include net-mask using IP-prefix notation.
IP-prefix notation
IP addresses can be defined with IP-prefix notation
using a slash (/
) character. The IP address to the LEFT of the slash (/
) is the base IP address. The number (1 to 127) to the RIGHT of the slash (/
)
is the number of contiguous 1 bits in the netmask.
Returns
If conversion is successful, the result will be a string representing a canonical IPv6 network address. If conversion isn't successful, the result will be null
.
Example
events
| project src_ip
| extend ipv6 = parse_ipv6(src_ip)
|take 3
ipv4 | ipv6 |
---|---|
192.168.255.255 | 0000:0000:0000:0000:0000:ffff:c0a8:ffff |
192.168.255.255/24 | 0000:0000:0000:0000:0000:ffff:c0a8:ff00 |
255.255.255.255 | 0000:0000:0000:0000:0000:ffff:ffff:ffff |