<?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: Convert an hexadecimal field to binary in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186635#M187035</link>
    <description>&lt;P&gt;The best approach might writing a custom lookup script, where you enter the HEX, and using a Python script returns the BIN as a string. If you look the example "external_lookup.py" inside $SPLUNK_HOME/etc/system/bin, you can see the main looping there, you could use the binascii Python library to easily convert.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 19:14:05 GMT</pubDate>
    <dc:creator>musskopf</dc:creator>
    <dc:date>2020-09-28T19:14:05Z</dc:date>
    <item>
      <title>Convert an hexadecimal field to binary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186631#M187031</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I'm trying to convert an hexadecimal field to base two (binary). &lt;BR /&gt;
Let me show you an exemple :&lt;BR /&gt;
field_hex=fffffffffffff83f &lt;BR /&gt;
my need =&amp;gt; 1111111111111111111111111111111111111111111111111111100000111111&lt;/P&gt;

&lt;P&gt;Actually, I try tonumber(field_hex, 2). &lt;/P&gt;

&lt;P&gt;I need to rex this output.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2015 13:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186631#M187031</guid>
      <dc:creator>lblum</dc:creator>
      <dc:date>2015-03-16T13:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convert an hexadecimal field to binary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186632#M187032</link>
      <description>&lt;P&gt;What  I can do actually : &lt;BR /&gt;
eval n=tonumber("3f", 16) | eval nn=tonumber("63", 10) | eval nnn=tonumber("00111111", 2)  | table _raw, n, nn, nnn&lt;BR /&gt;
=&amp;gt; 63, 63, 63&lt;/P&gt;

&lt;P&gt;Hexa :&lt;BR /&gt;
ff ff ff ff ff ff f8 3f&lt;BR /&gt;
Decimal :&lt;BR /&gt;
255 255 255 255 255 255 248 63&lt;BR /&gt;
Binary :&lt;BR /&gt;
11111111 11111111 11111111 11111111 11111111 11111111 11111000 00111111&lt;/P&gt;

&lt;P&gt;I need to regexp Binary result.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2015 14:03:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186632#M187032</guid>
      <dc:creator>lblum</dc:creator>
      <dc:date>2015-03-16T14:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Convert an hexadecimal field to binary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186633#M187033</link>
      <description>&lt;P&gt;I do not fully understand what you are trying to do, but would still like to recommend &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; to you. You can try regular expressions pretty nicely there.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2015 14:13:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186633#M187033</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-03-16T14:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert an hexadecimal field to binary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186634#M187034</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;In my log, I ve got :&lt;BR /&gt;
 09/02/15 00:00:00&amp;gt;1 00 00 21 00 fffffffffffff83f.&lt;BR /&gt;
To fully stat or report this line I need to convert hex to binary :&lt;BR /&gt;
 09/02/15 00:00:00&amp;gt;1 00 00 21 00 1111111111111111111111111111111111111111111111111111100000111111&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2015 14:45:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186634#M187034</guid>
      <dc:creator>lblum</dc:creator>
      <dc:date>2015-03-16T14:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert an hexadecimal field to binary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186635#M187035</link>
      <description>&lt;P&gt;The best approach might writing a custom lookup script, where you enter the HEX, and using a Python script returns the BIN as a string. If you look the example "external_lookup.py" inside $SPLUNK_HOME/etc/system/bin, you can see the main looping there, you could use the binascii Python library to easily convert.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:14:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186635#M187035</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2020-09-28T19:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Convert an hexadecimal field to binary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186636#M187036</link>
      <description>&lt;P&gt;I have no idea how well this will work/scale or if it would be viable solution, but thought it worth at least throwing out there...&lt;/P&gt;

&lt;P&gt;'| localop | stats count &lt;BR /&gt;
| eval blah = upper("fffffffffffff83f")&lt;BR /&gt;
| eval blah = split(blah,"") &lt;BR /&gt;
| mvexpand blah &lt;BR /&gt;
| eval blah=replace(blah,"1","0001")&lt;BR /&gt;
| eval blah=replace(blah,"2","0010")&lt;BR /&gt;
| eval blah=replace(blah,"3","0011")&lt;BR /&gt;
| eval blah=replace(blah,"4","0100")&lt;BR /&gt;
| eval blah=replace(blah,"5","0101")&lt;BR /&gt;
| eval blah=replace(blah,"6","0110")&lt;BR /&gt;
| eval blah=replace(blah,"7","0111")&lt;BR /&gt;
| eval blah=replace(blah,"8","1000")&lt;BR /&gt;
| eval blah=replace(blah,"9","1001")&lt;BR /&gt;
| eval blah=replace(blah,"A","1010")&lt;BR /&gt;
| eval blah=replace(blah,"B","1011")&lt;BR /&gt;
| eval blah=replace(blah,"C","1100")&lt;BR /&gt;
| eval blah=replace(blah,"D","1101")&lt;BR /&gt;
| eval blah=replace(blah,"E","1110")&lt;BR /&gt;
| eval blah=replace(blah,"F","1111")&lt;BR /&gt;
| mvcombine blah&lt;BR /&gt;
| eval blah = ltrim(mvjoin(blah,""),"0")'&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2015 02:35:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186636#M187036</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2015-03-17T02:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Convert an hexadecimal field to binary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186637#M187037</link>
      <description>&lt;P&gt;Actually, I guess you don't need to do all of the mv stuff...just a bunch of replaces might work.&lt;/P&gt;

&lt;P&gt;| localop | stats count &lt;BR /&gt;
| eval blah = upper("fffffffffffff83f")&lt;BR /&gt;
| eval blah=replace(blah,"1","0001")&lt;BR /&gt;
| eval blah=replace(blah,"2","0010")&lt;BR /&gt;
| eval blah=replace(blah,"3","0011")&lt;BR /&gt;
| eval blah=replace(blah,"4","0100")&lt;BR /&gt;
| eval blah=replace(blah,"5","0101")&lt;BR /&gt;
| eval blah=replace(blah,"6","0110")&lt;BR /&gt;
| eval blah=replace(blah,"7","0111")&lt;BR /&gt;
| eval blah=replace(blah,"8","1000")&lt;BR /&gt;
| eval blah=replace(blah,"9","1001")&lt;BR /&gt;
| eval blah=replace(blah,"A","1010")&lt;BR /&gt;
| eval blah=replace(blah,"B","1011")&lt;BR /&gt;
| eval blah=replace(blah,"C","1100")&lt;BR /&gt;
| eval blah=replace(blah,"D","1101")&lt;BR /&gt;
| eval blah=replace(blah,"E","1110")&lt;BR /&gt;
| eval blah=replace(blah,"F","1111")&lt;BR /&gt;
| eval blah = ltrim(tostring(blah),"0")&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2015 02:48:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-an-hexadecimal-field-to-binary/m-p/186637#M187037</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2015-03-17T02:48:35Z</dc:date>
    </item>
  </channel>
</rss>

