Splunk Search

How do I convert my decimal field to a hex value?

anssntaco
Path Finder

Very similar to http://splunk-base.splunk.com/answers/7688/how-do-i-convert-my-hexoct-field-into-a-decimal-value... but reverse. I have a field in decimal value, and would like to convert it to hex.

Doesn't look like there's an eval's "tohex()" equivalent to "tonumber()". Has anyone found a way to do this?

BTW, the internets have mentioned formulas that exist for this (e.g. http://www.webelfin.com/webelfindesign/dechex.html ). I'd rather not have to write my own search functions (not sure if it's even possible to write a custom tohex() function for eval), though I'm worried that may be the only option.

1 Solution

lguinn2
Legend

This is very easy, though it isn't intuitive!

eval yourHex = tostring(yourNumber,"hex")

View solution in original post

lguinn2
Legend

This is very easy, though it isn't intuitive!

eval yourHex = tostring(yourNumber,"hex")

anssntaco
Path Finder

Should've read the documentation a little closer. Thanks!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...