<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Converting a field value from Hexadecimal to Decimal... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14932#M1702</link>
    <description>&lt;P&gt;You can't really use regexes to do hex/dec conversion, so I don't think the &lt;CODE&gt;SEDCMD&lt;/CODE&gt; option will work. (Maybe you could pull it off with multiple &lt;CODE&gt;SEDCMD&lt;/CODE&gt; steps if you had just a 2 digit hex string, but even so that's still lots of overhead.)&lt;/P&gt;

&lt;P&gt;There is a &lt;A href="http://www.splunkbase.com/apps/All/3.x/Technologies/Splunk/app%3ahexdec" rel="nofollow"&gt;hexdec&lt;/A&gt; app out there written for 3.x.  But upgrading it to 4.x is just a matter of getting the metdata setup.  It converts both to and from hexadecimal and decimal.&lt;/P&gt;

&lt;P&gt;I really do wish splunk would allow some way of handling this out of the box.&lt;/P&gt;</description>
    <pubDate>Sat, 05 Jun 2010 04:19:15 GMT</pubDate>
    <dc:creator>Lowell</dc:creator>
    <dc:date>2010-06-05T04:19:15Z</dc:date>
    <item>
      <title>Converting a field value from Hexadecimal to Decimal...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14930#M1700</link>
      <description>&lt;P&gt;This may end up being a dumb question, but my regex/sed mojo is not strong today...&lt;/P&gt;

&lt;P&gt;I have 2 log files monitored that each refer to a "common" error code, but of course, one of them reports that code as a hex number, and the other reports it as the decimal representation of the same number (nothing like coding consistency!). I pull them each in as a separate sourcetype, and I want to be able to correlate across both sourcetypes, so I want to convert one of the two to match the other (so they're both hex or both dec - don't really care which). I'm planning on doing this as a SEDCMD- entry in transforms.conf, but can't figure out if I can do that - I know I can do it at search time with eval and tostring(), but I really want the field extracted and converted @ index time. &lt;/P&gt;

&lt;P&gt;Any thoughts?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2010 03:27:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14930#M1700</guid>
      <dc:creator>Steve_Litras</dc:creator>
      <dc:date>2010-06-05T03:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a field value from Hexadecimal to Decimal...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14931#M1701</link>
      <description>&lt;P&gt;There's no good way to convert from hex to decimal at index time. I'd suggest sticking to search time evaluation.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2010 03:39:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14931#M1701</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2010-06-05T03:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a field value from Hexadecimal to Decimal...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14932#M1702</link>
      <description>&lt;P&gt;You can't really use regexes to do hex/dec conversion, so I don't think the &lt;CODE&gt;SEDCMD&lt;/CODE&gt; option will work. (Maybe you could pull it off with multiple &lt;CODE&gt;SEDCMD&lt;/CODE&gt; steps if you had just a 2 digit hex string, but even so that's still lots of overhead.)&lt;/P&gt;

&lt;P&gt;There is a &lt;A href="http://www.splunkbase.com/apps/All/3.x/Technologies/Splunk/app%3ahexdec" rel="nofollow"&gt;hexdec&lt;/A&gt; app out there written for 3.x.  But upgrading it to 4.x is just a matter of getting the metdata setup.  It converts both to and from hexadecimal and decimal.&lt;/P&gt;

&lt;P&gt;I really do wish splunk would allow some way of handling this out of the box.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2010 04:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14932#M1702</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-06-05T04:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a field value from Hexadecimal to Decimal...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14933#M1703</link>
      <description>&lt;P&gt;At index time, you can only run regexes. I suppose if your life depended on it you could just enumerate the finite number of codes and SEDCMD each one, but seems much better to just do it at search time. If it's an issue of searching for the error codes, I'd suggest a search macro that would perform an eval on the macro argument (say, in decimal), figures out the hex equivalent and replaces the macro with an OR clause on both values.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2010 10:24:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14933#M1703</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-06-05T10:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a field value from Hexadecimal to Decimal...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14934#M1704</link>
      <description>&lt;P&gt;In Splunk 4.1.5 there is a new &lt;CODE&gt;eval&lt;/CODE&gt; function called &lt;CODE&gt;tonumber()&lt;/CODE&gt; which can be used to convert a hex value back to a decimal (based-10) value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval dec_field=tostring(hex_field, 16)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Prior to 4.1.5 you have to do hex-&amp;gt;dec conversions using and add-on search command; there was no way to do it out of the box.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2010 20:50:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-a-field-value-from-Hexadecimal-to-Decimal/m-p/14934#M1704</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-10-07T20:50:56Z</dc:date>
    </item>
  </channel>
</rss>

