TIBCO LogLogic LMI - Convert hex IP addresses to dotted-decimal notation

TIBCO LogLogic LMI - Convert hex IP addresses to dotted-decimal notation

book

Article ID: KB0077964

calendar_today

Updated On:

Products Versions
TIBCO LogLogic Enterprise Virtual Appliance all versions

Description

Occasionally, you may come across a hexadecimal formatted IP address, for example:
5321d28e

This IP format is probably most frequently seen when working with file-based data in BFQ files. Here is an example BFQ filename containing file-based data:
filedata_5_00000000000000000000ffff5321d28e_38201011.txt.gz

As can be seen in the example above, the hexadecimal-based IP is actually part of an IPv6 address and therefore preceded by FFFF because of the type of IPv6 notation LogLogic LMI uses.
For reference, when the IPv6 address is displayed with an IPv4 mapped into it we see an address like this:
::ffff:83.33.210.142

 

Issue/Introduction

This article shows how to convert an IP address given in hexadecimal format to dotted-decimal notation.

Resolution

To convert addresses still in hexidecimal format into the human readable, dotted-decimal notation (i.e. IPv4), simply use the following syntax at the MySQL prompt on the LMI CLI:
mysql> select inet_ntoa(conv('<IP_ADDRESS>', 16, 10));

For example, if we input the hex formatted IP 5321d28e then we see the output of the command is:
mysql> select inet_ntoa(conv('5321d28e', 16, 10));
+-------------------------------------+
| inet_ntoa(conv('5321d28e', 16, 10)) |
+-------------------------------------+
| 83.33.210.142                       |
+-------------------------------------+
1 row in set (0.00 sec)