Splunk Search

Hex to Floating Point converter?

pchiu
Engager

Hi,

I have a field that contrains a hex-string representing an encoded-float number (sign+exponent+mantissa).
What would be a (nice) way of evaluating it into another field that would contain the actual float value?

Ex: https://gregstoll.com/~gregstoll/floattohex/

Thanks

PS: I can't change the original hex-string.

Tags (3)
0 Karma

woodcock
Esteemed Legend

Show us the sample data and the field and what the sample data should look like after conversion.

0 Karma

jeanyvesnolen
Path Finder

You could use a scripted lookup with a small python script doing conversion

transforms.conf

        [hex_converter]
        external_cmd = hex_converter.py hexstring floatnum
        fields_list = hexstring , floatnum

You can after use it with (if number_hex is your field)

| lookup hex_converter hexstring AS number_hex 

And you can run it automatically if you want see (automatic lookup)

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...