<?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 Query syntax to only get 50% of possible results.  More details below. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Query-syntax-to-only-get-50-of-possible-results-More-details/m-p/378081#M168062</link>
    <description>&lt;P&gt;I am new to Splunk but own a system that uses Splunk as the backend.  I want to create a query that only gives me a specific percentage of the possible results that I can then leverage for a phased deployment.&lt;/P&gt;

&lt;P&gt;For example, I have 10,000 endpoints reporting in but I want to create a query that gives me a random 50% (5,000) of those endpoints as a result.  I can then use that query to target a deployment to the company in two phases.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 19:35:15 GMT</pubDate>
    <dc:creator>dexterrivera</dc:creator>
    <dc:date>2018-07-27T19:35:15Z</dc:date>
    <item>
      <title>Query syntax to only get 50% of possible results.  More details below.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-syntax-to-only-get-50-of-possible-results-More-details/m-p/378081#M168062</link>
      <description>&lt;P&gt;I am new to Splunk but own a system that uses Splunk as the backend.  I want to create a query that only gives me a specific percentage of the possible results that I can then leverage for a phased deployment.&lt;/P&gt;

&lt;P&gt;For example, I have 10,000 endpoints reporting in but I want to create a query that gives me a random 50% (5,000) of those endpoints as a result.  I can then use that query to target a deployment to the company in two phases.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:35:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-syntax-to-only-get-50-of-possible-results-More-details/m-p/378081#M168062</guid>
      <dc:creator>dexterrivera</dc:creator>
      <dc:date>2018-07-27T19:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Query syntax to only get 50% of possible results.  More details below.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-syntax-to-only-get-50-of-possible-results-More-details/m-p/378082#M168063</link>
      <description>&lt;P&gt;There is a random number generator in splunk.  You use the mod function (&lt;CODE&gt;%&lt;/CODE&gt;) to turn it to whatever set of numbers you want.&lt;/P&gt;

&lt;P&gt;In this case, you could...&lt;/P&gt;

&lt;P&gt;1) Create a lookup file (for instance mySystems.csv) that includes ALL the systems.&lt;/P&gt;

&lt;P&gt;2)  assign each  system a random number from 1 to 100&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | inputlookup mySystems.csv
  | eval myGroup=1+ (random() % 100)
  | outputlookup append=f mySystems.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) If new Systems get added, append them with another number (101, 102).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (your search that finds all systems)
  | lookup host mySystems.csv OUTPUT myGroup
  | eventstats max(myGroup) as maxGroup
  | where isnull(myGroup)
  | eval myGroup=maxGroup+1
  | fields - maxGroup
  | outputlookup append=tf mySystems.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;4)  Each time you do something to a set, select a non-overlapping myGroup number range that you havene't done it to before.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 00:57:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-syntax-to-only-get-50-of-possible-results-More-details/m-p/378082#M168063</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-07-28T00:57:57Z</dc:date>
    </item>
  </channel>
</rss>

