parseHex Operator
The parseHex operator allows you to convert a hexadecimal string of 16 or fewer characters to a number.
Syntax
parseHex(<hexadecimal_field>) as <field>parseHex("<hexadecimal_string>") as <field>
Rules
parseHex("ABCD")andparseHex("0xABCD")are both valid formats.
Examples
Convert a literal hex string to a decimal value
The following query will convert a hexadecimal string to a decimal number.
* | parseHex("12D230") as decimalValue
It provides the following results:
Convert a hex field parsed from logs using 0x prefix format
=application/backend
| parse "error_code=*" as hex_code
| parseHex(hex_code) as error_number
| count by error_number
| sort by _count desc