<?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 Help with syntax to search across all bins in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584565#M203644</link>
    <description>&lt;P&gt;Howdy,&lt;/P&gt;
&lt;P&gt;I'm trying to come up with a query that charts the most occurring x_forwarded_for and respective count in each of the bins over whatever window. Currently, the below query creates a sorted chart of the most occurring x_forwarded_for and their respective count over the entire lookback window, instead of each bin. I think I need to fit head 1 in there somewhere.&lt;BR /&gt;&lt;BR /&gt;It's likely some or all of the x_forwarded_for's across those bins are repeats and I'd like that charted, so no unique counts.&lt;/P&gt;
&lt;P&gt;Any help is appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="canvas_*" cluster="*" | where isnull(user_id)| bin _time span=5m | stats count by x_forwarded_for | sort - count&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Feb 2022 17:33:44 GMT</pubDate>
    <dc:creator>tcouture37</dc:creator>
    <dc:date>2022-02-10T17:33:44Z</dc:date>
    <item>
      <title>Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584565#M203644</link>
      <description>&lt;P&gt;Howdy,&lt;/P&gt;
&lt;P&gt;I'm trying to come up with a query that charts the most occurring x_forwarded_for and respective count in each of the bins over whatever window. Currently, the below query creates a sorted chart of the most occurring x_forwarded_for and their respective count over the entire lookback window, instead of each bin. I think I need to fit head 1 in there somewhere.&lt;BR /&gt;&lt;BR /&gt;It's likely some or all of the x_forwarded_for's across those bins are repeats and I'd like that charted, so no unique counts.&lt;/P&gt;
&lt;P&gt;Any help is appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="canvas_*" cluster="*" | where isnull(user_id)| bin _time span=5m | stats count by x_forwarded_for | sort - count&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 17:33:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584565#M203644</guid>
      <dc:creator>tcouture37</dc:creator>
      <dc:date>2022-02-10T17:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584570#M203646</link>
      <description>&lt;P class="lia-align-left"&gt;You start pretty well but then you lose the time information along the way&lt;/P&gt;&lt;PRE&gt;index="canvas_*" cluster=* NOT user_id=*&lt;BR /&gt;| bin _time span=5m&lt;BR /&gt;| stats count by x_forwarded_for _time&lt;BR /&gt;| sort _time - count&lt;BR /&gt;| stats first(*) by _time&lt;/PRE&gt;&lt;P&gt;If I understand correctly what you want to achieve.&lt;/P&gt;&lt;P&gt;If you want more than one "top" result, instead of stats first you'd need to do streamstats count to add rank order and do a where to limit results by this rank value.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 18:08:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584570#M203646</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-10T18:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584589#M203653</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;If you want more than one "top" result, instead of stats first you'd need to do streamstats count to add rank order and do a where to limit results by this rank value.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Should I interpret this as in more than one "top" result across the first bin or across all bins?&lt;BR /&gt;&lt;BR /&gt;The query you provided &lt;EM&gt;almost&amp;nbsp;&amp;nbsp;&lt;/EM&gt;gets me there. I was hoping it would get the top value across all bins. This seems to just return the highest count value for the first bin.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 20:14:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584589#M203653</guid>
      <dc:creator>tcouture37</dc:creator>
      <dc:date>2022-02-10T20:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584594#M203654</link>
      <description>&lt;P&gt;Hmm. That should have given you top values for every bin. At least that's how I understood your specs.&lt;/P&gt;&lt;P&gt;Drop the last stats and see what you get.&lt;/P&gt;&lt;P&gt;You should get a table of counted x_forwarded_for values sorted by count, groupped by time (divided into 5-minute bins)&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 21:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584594#M203654</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-10T21:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584597#M203655</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hmm. That should have given you top values for every bin. At least that's how I understood your specs.&lt;/P&gt;&lt;P&gt;Drop the last stats and see what you get.&lt;/P&gt;&lt;P&gt;You should get a table of counted x_forwarded_for values sorted by count, groupped by time (divided into 5-minute bins)&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;BR /&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;x_forwarded_for&lt;/TD&gt;&lt;TD&gt;_time&lt;/TD&gt;&lt;TD&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="54.9688px" height="25px"&gt;x.x.x.1&lt;/TD&gt;&lt;TD width="166.047px" height="25px"&gt;2022-02-10 13:20:00&lt;/TD&gt;&lt;TD width="40px" height="25px"&gt;191&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="54.9688px" height="25px"&gt;x.x.x.2&lt;/TD&gt;&lt;TD width="166.047px" height="25px"&gt;2022-02-10 13:20:00&lt;/TD&gt;&lt;TD width="40px" height="25px"&gt;77&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="54.9688px" height="25px"&gt;x.x.x.3&lt;/TD&gt;&lt;TD width="166.047px" height="25px"&gt;2022-02-10 13:20:00&lt;/TD&gt;&lt;TD width="40px" height="25px"&gt;66&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;every ip in the table is in the same 13:20:00 _time bin when I remove the last stat.&lt;BR /&gt;&lt;BR /&gt;One thing that might be interesting to note, when I do execute the query with stats first(*) by _time, halfway through the execution, it seems like there's a chart with a row for every bin with an x_forwarded_for value and count associated with that _time bin. By the end of the execution, that list is compressed to a single row.&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 10 Feb 2022 21:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584597#M203655</guid>
      <dc:creator>tcouture37</dc:creator>
      <dc:date>2022-02-10T21:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584599#M203656</link>
      <description>&lt;P&gt;Ok. If you drop the last stats you should get the table like you showed.&lt;/P&gt;&lt;P&gt;After all the rows with decreasing counts at 2022-02-10 13:20:00, you should get similarily sorted entries from 13:25, then from 13:30 and so on (that's where stats first picks from).&lt;/P&gt;&lt;P&gt;Look at this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_20220210-225051_Firefox Beta.jpg" style="width: 2048px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17935i2D48A82A0DD9A9CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot_20220210-225051_Firefox Beta.jpg" alt="Screenshot_20220210-225051_Firefox Beta.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 21:52:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584599#M203656</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-10T21:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584601#M203657</link>
      <description>&lt;P&gt;Is there a way to only display the top 10 results from each bin? With my dataset, there are so many different x_forwarded_for that there are 100 pages (max return) with 100 x_forwarded_for ips per page for just the first bin in the lookback window.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 22:03:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584601#M203657</guid>
      <dc:creator>tcouture37</dc:creator>
      <dc:date>2022-02-10T22:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584603#M203659</link>
      <description>&lt;P&gt;As I said, if you want top X from each bin, you have to count and filter &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So instead of the | stats first... you do&lt;/P&gt;&lt;PRE&gt;| streamstats count as rank by _time&lt;BR /&gt;| where rank&amp;lt;=X&lt;/PRE&gt;&lt;P&gt;Oh, and if you have so many results, add limit of 0 to sort. Like instead of&lt;/P&gt;&lt;PRE&gt;| sort _time - count&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;do&lt;/P&gt;&lt;PRE&gt;| sort 0 _time - count&lt;/PRE&gt;&lt;P&gt;(i keep forgetting about it)&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 22:09:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584603#M203659</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-10T22:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584616#M203665</link>
      <description>&lt;P&gt;Ohhhh, you really meant creating rank as a variable and using that. This is working like a charm!&lt;BR /&gt;&lt;BR /&gt;You are a rockstar and have helped me better understand bin and TIL streamstats. Thank you very much PickleRick.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 23:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584616#M203665</guid>
      <dc:creator>tcouture37</dc:creator>
      <dc:date>2022-02-10T23:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with syntax to search across all bins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584651#M203671</link>
      <description>&lt;P&gt;I'm happy I could have been of help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Have much fun with your splunk!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 06:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-syntax-to-search-across-all-bins/m-p/584651#M203671</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-11T06:50:51Z</dc:date>
    </item>
  </channel>
</rss>

