Getting Data In

Can splunk convert input files contents from Hexadecimal to Decimal?

Chris_R_
Splunk Employee
Splunk Employee

Specifically monitoring a AppServer that outputs to a file storing in hexadecimal format.
Can we specify the charset when monitoring? (cant find it listed iconv -l) or any functions that can do a conversion or other methods to convert?

Tags (1)
0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

It's not clear to me what you mean. "hexadecimal" is not a charset or character set. If you have hex data, it's actually either binary, or a text representation of binary data. Splunk will not convert this. In general, while Splunk handles different actual character sets of text, it does not convert generic data other than gzipped or similarly compressed data.

View solution in original post

Lowell
Super Champion

There is a new search-time option for this scenario. In splunk 4.1.5 the tonumber() eval command was added. This function allows conversions between different bases which can convert from hexadecimal (base-16) to a standard (base 10) value.

| eval dec_value = tonumber(hex_value, 16)

Of course you'd have to do this many times depending on how many fields you have.

Chris_R_
Splunk Employee
Splunk Employee

I was sent some raw sample data, which brought up the question
2010-03-12 00:01:08 EST 0003f900 0003227a 0059 0059 0000 0001 00000000 0000 0002 00000000 00000001 00000001
2010-03-12 00:02:08 EST 0003f900 00031ce3 0059 0059 0000 0001 00000000 0000 0002 00000000 00000001 00000001
2010-03-12 00:03:08 EST 0003f900 000316d1 0059 0059 0000 0001 00000000 0000 0002 00000000 00000001 00000001

I imagine they wanted to convert the first two columns to decimal values. The scripted option of doing the conversion was on the table, ill go that route. Thanks for the help

0 Karma

Paolo_Prigione
Builder

Hi Chris, I'll second gkanapathy objections on hex and charset.

I'll add that if you know a way to convert your AppServer logs to a textual (meaningful) representation, you should be able to create a scripted input which runs the conversion script and imports its output. An example of this is the solaris utmpx data structures, which you can import by running the "last" command.

Paolo

gkanapathy
Splunk Employee
Splunk Employee

It's not clear to me what you mean. "hexadecimal" is not a charset or character set. If you have hex data, it's actually either binary, or a text representation of binary data. Splunk will not convert this. In general, while Splunk handles different actual character sets of text, it does not convert generic data other than gzipped or similarly compressed data.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

Ready to make your IT operations smarter and more efficient? Discover how to automate Splunk alerts with Red ...