<?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 Bitwise workaround in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92656#M23923</link>
    <description>&lt;P&gt;I have a field StreamId=0x12da3b7514f19ce7&lt;BR /&gt;
I want to do this:&lt;BR /&gt;
(StreamId &amp;gt;&amp;gt; &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; &amp;amp; 0xFFFFFFFF&lt;/P&gt;

&lt;P&gt;I know I can /256 to shift 8, but I'm trying for a one-liner without any custom macros or search commands.&lt;/P&gt;

&lt;P&gt;Without an extensive eval/if(if(if(if(...&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Bob&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jan 2013 20:14:01 GMT</pubDate>
    <dc:creator>tincupchalice</dc:creator>
    <dc:date>2013-01-18T20:14:01Z</dc:date>
    <item>
      <title>Bitwise workaround</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92656#M23923</link>
      <description>&lt;P&gt;I have a field StreamId=0x12da3b7514f19ce7&lt;BR /&gt;
I want to do this:&lt;BR /&gt;
(StreamId &amp;gt;&amp;gt; &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; &amp;amp; 0xFFFFFFFF&lt;/P&gt;

&lt;P&gt;I know I can /256 to shift 8, but I'm trying for a one-liner without any custom macros or search commands.&lt;/P&gt;

&lt;P&gt;Without an extensive eval/if(if(if(if(...&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Bob&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2013 20:14:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92656#M23923</guid>
      <dc:creator>tincupchalice</dc:creator>
      <dc:date>2013-01-18T20:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Bitwise workaround</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92657#M23924</link>
      <description>&lt;P&gt;I don't think splunk does bitwise operations. After all, for bitwise operations you first need an agreement on how a number looks like in bits, and that doesn't feel splunky.&lt;/P&gt;

&lt;P&gt;However, you can shimmy your way around that with a bit of maths. You already said how shifting is nothing else than dividing by a power of two and then flooring the result, that's the first step. Second, a bitwise and throwing out a number of starting bits and keeping all the bits after that is nothing other than a modulo operation. For instance 0x123 &amp;amp; 0xff is 0x23, yes? Going decimal, 0x123 is 291, doing 291 % 256 yields 35 - which is 0x23.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jan 2013 16:42:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92657#M23924</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-01-19T16:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Bitwise workaround</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92658#M23925</link>
      <description>&lt;P&gt;Yes, it's code - but this would probably be a good place for a dynamic lookup.  Your lookup could perform the bitwise operations and return a new field with the new value.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Jan 2013 18:05:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92658#M23925</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2013-01-20T18:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Bitwise workaround</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92659#M23926</link>
      <description>&lt;P&gt;| rex field=StreamId "0x(?&amp;lt;oct4&amp;gt;\S{2})(?&amp;lt;oct3&amp;gt;\S{2})(?&amp;lt;oct2&amp;gt;\S{2})(?&amp;lt;oct1&amp;gt;\S{2})(?&amp;lt;engine&amp;gt;\S{2})"&lt;BR /&gt;&lt;BR /&gt;
| eval oct1=tonumber(oct1, 16)&lt;BR /&gt;&lt;BR /&gt;
| eval oct2=tonumber(oct2, 16)&lt;BR /&gt;&lt;BR /&gt;
| eval oct3=tonumber(oct3, 16)&lt;BR /&gt;&lt;BR /&gt;
| eval oct4=tonumber(oct4, 16)&lt;BR /&gt;&lt;BR /&gt;
| eval Engine=tonumber(engine, 16)&lt;BR /&gt;&lt;BR /&gt;
| eval Machine=oct1.".".oct2.".".oct3.".".oct4&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;This worked for me, now I just need to | nslookup.  Thanks for the input.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2013 15:03:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bitwise-workaround/m-p/92659#M23926</guid>
      <dc:creator>tincupchalice</dc:creator>
      <dc:date>2013-01-22T15:03:11Z</dc:date>
    </item>
  </channel>
</rss>

