Knowledge Base Article

Convert Quad Decimal IP Addresses To IP Integers

This expression will convert IP addresses in the quad decimal format of 'www.xxx.yyy.zzz' to integers that can be used for further analysis (eg. cross referenced to a geo-location).
For example, it would convert the string '66.249.66.1' to the integer 1123631617.
  1. Make sure your field that holds the quad decimal IP address is a string.
  2. In the same table, click Add new custom field, name it "ip_integer" and select BigInt as the type.
  3. Edit the expression of the new custom field to be:
( tobigint( strparts( <IP_field> , '.' , 1 )) * 16777216 ) + ( tobigint( strparts( <IP_field>, '.' , 2 )) * 65536 ) + ( tobigint( strparts (<IP_field> , '.' , 3 )) * 256 ) + ( tobigint( strparts( <IP_field> , '.' , 4 )))
Where <IP_field> is the name of your field that contains the string of your quad decimal IP addresses.
0
Post actions

Updated 03-02-2023
No CommentsBe the first to comment