GitHubContribute in GitHub: Edit online

parse_ipv4()

Converts IPv4 string to long (signed 64-bit) number representation.

parse_ipv4("127.0.0.1") == 2130706433
parse_ipv4('192.1.168.1') < parse_ipv4('192.1.168.2') == true

Syntax

parse_ipv4(Expr)

Arguments

Name Type Required Description
Expr String A string or number representation of the IPv4 address.

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 32) to the RIGHT of the slash (/) is the number of contiguous 1 bit in the netmask.

For example, 192.168.2.0/24 will have an associated net/subnetmask containing 24 contiguous bits or 255.255.255.0 in dotted decimal format.

Returns

If conversion is successful, the result will be a long number. If conversion isn't successful, the result will be null.

Example

events    
    | project src_ip   
    | extend ip_long = parse_ipv4(src_ip)
    | take 3

Results

ip_string ip_long
192.168.1.1 3232235777
192.168.1.1/24 3232235776
255.255.255.255/31 4294967294