<?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: filter stats on two different &amp;quot;where&amp;quot; clauses in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348745#M103222</link>
    <description>&lt;P&gt;Well, I used join because I get staggered table results when I use append search. If I use neither, and simply combine my stats clauses [|stats count as retries, dc(gateway) as gateways by CN | where gateways&amp;gt;3 AND retries&amp;gt;100], the search only picks up the retries limit and not the gateway count.&lt;BR /&gt;
 index=x, host=y sourcetype=z for both searches, no different.&lt;/P&gt;

&lt;P&gt;As for sample data, here are the results when I try to run this... &lt;BR /&gt;
Not what I want (triggered for number of retries, but not for number of gateways)&lt;BR /&gt;
gateway gateways    corenode    retries&lt;BR /&gt;
hys              4                       DEN             1878&lt;/P&gt;

&lt;P&gt;This is what I want:  more than 3 gateways crossed the 100 retries limit.&lt;BR /&gt;
gateway gateways    corenode    retries&lt;BR /&gt;
den             4                SLC               108&lt;BR /&gt;
rks                 4                SLC               303&lt;BR /&gt;
rno                     4                SLC             1335&lt;BR /&gt;
sgu                 4                SLC             6180&lt;/P&gt;</description>
    <pubDate>Sat, 17 Jun 2017 12:04:39 GMT</pubDate>
    <dc:creator>mbond81</dc:creator>
    <dc:date>2017-06-17T12:04:39Z</dc:date>
    <item>
      <title>filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348742#M103219</link>
      <description>&lt;P&gt;Bonus points to the folks who can help me.&lt;BR /&gt;
I'm trying to first filter (stats count) results above a threshold of 100 -AND- of those results, I need there to be more than 3 in order to be considered a problem. So far my search is showing me 1 result, when I want it to show me "no results" if there aren't more than 3. &lt;BR /&gt;
There are 4 or more "gateways" per "core node". I want to know which "core node" has 4 or more of it's "gateways" over the "retries" message threshold. &lt;/P&gt;

&lt;P&gt;index= host=  sourcetype=&lt;BR /&gt;&lt;BR /&gt;
|stats count as retries by gateway corenode &lt;BR /&gt;
| join [search index=  host=  sourcetype= &lt;BR /&gt;
| stats dc(gateway) as gateways by corenode] &lt;BR /&gt;
| where gateways&amp;gt;3 AND retries&amp;gt;100 &lt;BR /&gt;
| table gateway gateways corenode retries&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 23:47:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348742#M103219</guid>
      <dc:creator>mbond81</dc:creator>
      <dc:date>2017-06-16T23:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348743#M103220</link>
      <description>&lt;P&gt;Hi mbond81,&lt;BR /&gt;
to get help at splunk answers more quickly you should always provide some sample data when possible. &lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 00:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348743#M103220</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2017-06-17T00:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348744#M103221</link>
      <description>&lt;P&gt;You have not mentioned the reason for JOIN. Is the index, source and sourcetype same in both your query?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Your Base Search&amp;gt;
| stats count as retries by gateway corenode 
| search retries&amp;gt;100
| eval gateway_retries= gateway."-".retries
| stats dc(gateway) as gateways values(gateway_retries) as gateway_retries by corenode
| search gateways&amp;gt;3
| table corenode gateways gateway_retries
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Jun 2017 05:58:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348744#M103221</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-06-17T05:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348745#M103222</link>
      <description>&lt;P&gt;Well, I used join because I get staggered table results when I use append search. If I use neither, and simply combine my stats clauses [|stats count as retries, dc(gateway) as gateways by CN | where gateways&amp;gt;3 AND retries&amp;gt;100], the search only picks up the retries limit and not the gateway count.&lt;BR /&gt;
 index=x, host=y sourcetype=z for both searches, no different.&lt;/P&gt;

&lt;P&gt;As for sample data, here are the results when I try to run this... &lt;BR /&gt;
Not what I want (triggered for number of retries, but not for number of gateways)&lt;BR /&gt;
gateway gateways    corenode    retries&lt;BR /&gt;
hys              4                       DEN             1878&lt;/P&gt;

&lt;P&gt;This is what I want:  more than 3 gateways crossed the 100 retries limit.&lt;BR /&gt;
gateway gateways    corenode    retries&lt;BR /&gt;
den             4                SLC               108&lt;BR /&gt;
rks                 4                SLC               303&lt;BR /&gt;
rno                     4                SLC             1335&lt;BR /&gt;
sgu                 4                SLC             6180&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 12:04:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348745#M103222</guid>
      <dc:creator>mbond81</dc:creator>
      <dc:date>2017-06-17T12:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348746#M103223</link>
      <description>&lt;P&gt;Without seeing any sample data and limited information on the query, my suggestion is to simply try using &lt;CODE&gt;search&lt;/CODE&gt; instead of &lt;CODE&gt;where&lt;/CODE&gt;. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|search gateways&amp;gt;3 retries&amp;gt;100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But if you could provide sample data, that would be more helpful, as well as if the data is in separate source types.  I think you might be able to get by without the join and just use stats command to bring the information together. &lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 15:42:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348746#M103223</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-06-17T15:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348747#M103224</link>
      <description>&lt;P&gt;The gateways are named, not numbered - so I need to dc(count) them by core node first in order to get a count I can filter on. &lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 15:51:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348747#M103224</guid>
      <dc:creator>mbond81</dc:creator>
      <dc:date>2017-06-17T15:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348748#M103225</link>
      <description>&lt;P&gt;I think that works! I ran it against 2 cases, 1 that should've returned my &amp;gt;3 gateways and one that should not have and it worked as expected &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thank you so much!!&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 15:56:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348748#M103225</guid>
      <dc:creator>mbond81</dc:creator>
      <dc:date>2017-06-17T15:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348749#M103226</link>
      <description>&lt;P&gt;Answered (solved) by Niketnilay. Thanks so much!&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 15:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348749#M103226</guid>
      <dc:creator>mbond81</dc:creator>
      <dc:date>2017-06-17T15:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: filter stats on two different "where" clauses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348750#M103227</link>
      <description>&lt;P&gt;@mbond81, I have converted my comment to answer. Please accept to mark this as answered!&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 23:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-stats-on-two-different-quot-where-quot-clauses/m-p/348750#M103227</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-06-17T23:51:38Z</dc:date>
    </item>
  </channel>
</rss>

