<?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: show/where the result from count when result is odd or even number in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314716#M164704</link>
    <description>&lt;P&gt;@Mike6960, you can perform a &lt;CODE&gt;modular division by 2&lt;/CODE&gt; to identify &lt;CODE&gt;0 as Even&lt;/CODE&gt; and &lt;CODE&gt;1 as Odd&lt;/CODE&gt;. i.e. &lt;CODE&gt;&amp;lt;YourCountField&amp;gt;%2&lt;/CODE&gt;. Please try the following run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd
|  stats count as Total by component
|  eval Filter=if(Total%2==0,"Even","Odd")
|  search Filter="Odd"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 29 Nov 2017 11:26:04 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-11-29T11:26:04Z</dc:date>
    <item>
      <title>show/where the result from count when result is odd or even number</title>
      <link>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314715#M164703</link>
      <description>&lt;P&gt;Is it possible to search results from a count when they are odd or even?&lt;BR /&gt;
So the results only show the lines/events which have an odd or even number as count&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 11:00:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314715#M164703</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-29T11:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: show/where the result from count when result is odd or even number</title>
      <link>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314716#M164704</link>
      <description>&lt;P&gt;@Mike6960, you can perform a &lt;CODE&gt;modular division by 2&lt;/CODE&gt; to identify &lt;CODE&gt;0 as Even&lt;/CODE&gt; and &lt;CODE&gt;1 as Odd&lt;/CODE&gt;. i.e. &lt;CODE&gt;&amp;lt;YourCountField&amp;gt;%2&lt;/CODE&gt;. Please try the following run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd
|  stats count as Total by component
|  eval Filter=if(Total%2==0,"Even","Odd")
|  search Filter="Odd"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Nov 2017 11:26:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314716#M164704</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-29T11:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: show/where the result from count when result is odd or even number</title>
      <link>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314717#M164705</link>
      <description>&lt;P&gt;Great idea. Thanks. I am trying to understand, what if the count is e.g. 4? Then Total(4) divided by 2 isn't 0. Or do i not understand the way "%2==0" works?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 13:58:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314717#M164705</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-29T13:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: show/where the result from count when result is odd or even number</title>
      <link>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314718#M164706</link>
      <description>&lt;P&gt;Modular division returns the&lt;CODE&gt;remainder&lt;/CODE&gt;, so modular division by 2 can only result in a &lt;CODE&gt;1&lt;/CODE&gt; or &lt;CODE&gt;0&lt;/CODE&gt;. Therefore &lt;CODE&gt;4%2===0&lt;/CODE&gt;. &lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 14:26:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314718#M164706</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-11-29T14:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: show/where the result from count when result is odd or even number</title>
      <link>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314719#M164707</link>
      <description>&lt;P&gt;@Mike6960, Modular division gives you remainder. Any Integer divided by 2 will give Either 0 i.e. is it is divisible by 2 or it gives 1 i.e. it gives a remainder of 1.&lt;/P&gt;

&lt;P&gt;Try the following run anywhere search, which should explain the process:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  gentimes start=11/10/2017 end=11/20/2017 increment=1d
|  fields starttime
|  rename starttime as _time
|  eval Dividend=1
|  eval Divisor=2
|  accum Dividend
|  eval ModularDivisionRemainder=Dividend%Divisor
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Nov 2017 14:34:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314719#M164707</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-29T14:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: show/where the result from count when result is odd or even number</title>
      <link>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314720#M164708</link>
      <description>&lt;P&gt;Aha, thanks. This clearifies the 'modulair division' . But also very usefull because I did not know of the accum command, gentimes. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;BR /&gt;
Also I did not know it was possible to 'insert' values (Dividend in your example). All in all, I learned a lot again.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 07:11:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314720#M164708</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-30T07:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: show/where the result from count when result is odd or even number</title>
      <link>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314721#M164709</link>
      <description>&lt;P&gt;@Mike6960, Anytime. That's the beauty of this community, we all learn something new everyday &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 08:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/show-where-the-result-from-count-when-result-is-odd-or-even/m-p/314721#M164709</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-30T08:31:48Z</dc:date>
    </item>
  </channel>
</rss>

