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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...