<?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: How to select only specific events from the search to do stats on? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225604#M66531</link>
    <description>&lt;P&gt;That's similar to what I am looking for, but am facing issue here. In the above thing, I want to decide number 12 by doing math with total events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval sno=1 | accum sno | eventstats count as totalEvents |eval div=totalEvents /5000  |where floor(sno/div)=(sno/div) | rest of your search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it's not giving me correct results!&lt;/P&gt;</description>
    <pubDate>Thu, 28 Apr 2016 18:31:42 GMT</pubDate>
    <dc:creator>reachskhm</dc:creator>
    <dc:date>2016-04-28T18:31:42Z</dc:date>
    <item>
      <title>How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225598#M66525</link>
      <description>&lt;P&gt;Need a way to select only specific events from the list of events, so here the example I have a query on iis logs which gives me around say 60000 events so I want to select every 12th event from the the searched 60 events to do stats on those filtered events.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 15:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225598#M66525</guid>
      <dc:creator>reachskhm</dc:creator>
      <dc:date>2016-04-28T15:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225599#M66526</link>
      <description>&lt;P&gt;Try this&lt;BR /&gt;
    your base search | streamstats window=12 current=t count | where count=12 | stats ...&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225599#M66526</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-04-28T16:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225600#M66527</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval sno=1 | accum sno | where floor(sno/12)=(sno/12) | rest of your search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:31:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225600#M66527</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-28T16:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225601#M66528</link>
      <description>&lt;P&gt;thanks for the resposne , have one more question , how to could store a event count of search so that i can do some arithmetic on it.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 17:04:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225601#M66528</guid>
      <dc:creator>reachskhm</dc:creator>
      <dc:date>2016-04-28T17:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225602#M66529</link>
      <description>&lt;P&gt;Not sure I get it. Do you want to count of total search results in a field so that you can do some calculation (like percentage calculation) on it?&lt;/P&gt;

&lt;P&gt;If above is true, you can use eventstats command to add aggregation in a new field, without changing/aggregating the search results.&lt;/P&gt;

&lt;P&gt;e.g. This will give you field totalEvents with total events before the filter.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval sno=1 | accum sno | eventstats count as totalEvents | where floor(sno/12)=(sno/12) | rest of your search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Apr 2016 18:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225602#M66529</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-28T18:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225603#M66530</link>
      <description>&lt;P&gt;This will just exclude first 11 events&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 18:19:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225603#M66530</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-28T18:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225604#M66531</link>
      <description>&lt;P&gt;That's similar to what I am looking for, but am facing issue here. In the above thing, I want to decide number 12 by doing math with total events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval sno=1 | accum sno | eventstats count as totalEvents |eval div=totalEvents /5000  |where floor(sno/div)=(sno/div) | rest of your search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it's not giving me correct results!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 18:31:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225604#M66531</guid>
      <dc:creator>reachskhm</dc:creator>
      <dc:date>2016-04-28T18:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225605#M66532</link>
      <description>&lt;P&gt;Could you explain what exactly is your requirement? You want to take every 12th event for your stats and use the total events (before 12th event filter) and using it for what?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 20:51:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225605#M66532</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-28T20:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to select only specific events from the search to do stats on?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225606#M66533</link>
      <description>&lt;P&gt;Need to get a sample size of 5000 events to calculate mean and Standerddeviation for each day fro last 60 days, so in order to get get a random sample of 5000 events and calculating total events and then div is the floor (totalevents/5000) Then as I get this, I am picking each event based on div (like 12 before).&lt;/P&gt;

&lt;P&gt;I am able to get it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval sno=1 | accum sno | eventstats count as totalEvents |eval div=floor(totalEvents /5000) |where floor(sno/div)=(sno/div) | head 5000| timechart span=1d  avg(filedx) stddev(filedx).. 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there anything wrong with this search?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 21:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-only-specific-events-from-the-search-to-do-stats/m-p/225606#M66533</guid>
      <dc:creator>reachskhm</dc:creator>
      <dc:date>2016-04-28T21:06:53Z</dc:date>
    </item>
  </channel>
</rss>

