<?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: Is event sampling possible using the REST API? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211149#M41571</link>
    <description>&lt;P&gt;Also, this will work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... | eval a=random()%10 | where a=7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks @micah in irc&lt;/P&gt;</description>
    <pubDate>Mon, 22 Aug 2016 19:00:17 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2016-08-22T19:00:17Z</dc:date>
    <item>
      <title>Is event sampling possible using the REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211144#M41566</link>
      <description>&lt;P&gt;The documentation describes how to set the sampling ratio in the Search app and dashboards, but not when using the REST API.&lt;/P&gt;

&lt;P&gt;Is sampling possible using the REST API?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 13:59:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211144#M41566</guid>
      <dc:creator>buntinas</dc:creator>
      <dc:date>2016-06-15T13:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is event sampling possible using the REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211145#M41567</link>
      <description>&lt;P&gt;Hi  , I am also trying to understand if possible &lt;BR /&gt;
Any update ? &lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 10:05:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211145#M41567</guid>
      <dc:creator>eyalsharon</dc:creator>
      <dc:date>2016-08-22T10:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is event sampling possible using the REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211146#M41568</link>
      <description>&lt;P&gt;&amp;amp;dispatch.sample_ratio=10 appears in the URL when I select 1:10.&lt;/P&gt;

&lt;P&gt;So i will assume something like that is what you want to add to your request.&lt;/P&gt;

&lt;P&gt;I did some testing, and I get multiple lists of results back.&lt;/P&gt;

&lt;P&gt;The first list of results is the sample.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 16:54:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211146#M41568</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-08-22T16:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is event sampling possible using the REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211147#M41569</link>
      <description>&lt;P&gt;You might prefer to just use the | head command instead...&lt;/P&gt;

&lt;P&gt;... | head 10 &lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 17:16:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211147#M41569</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-08-22T17:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is event sampling possible using the REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211148#M41570</link>
      <description>&lt;P&gt;I dont like how the results still had all 15 billion results even though the sample ratio was set.  So I used a similar technique to achieve similar results.  First I created a command called randomint, then i used it in my search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ...| randomint 1 100| where randomint=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ...| randomint 1 100| where randomint=34
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give a ratio of 1:100 of random events when executed by the API.  I put the randomint command in my toolkit app: &lt;A href="https://splunkbase.splunk.com/app/3265/"&gt;https://splunkbase.splunk.com/app/3265/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Basically you're attaching a field called randomint to all the events in the search pipeline, and then you're using a where clause to narrow down to just events that match 1 number between 1 and 100.  If you wanted a different ration, you'd just do something like &lt;CODE&gt;...| randomint 1:50 | where randomint=17&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 17:58:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211148#M41570</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-08-22T17:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is event sampling possible using the REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211149#M41571</link>
      <description>&lt;P&gt;Also, this will work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... | eval a=random()%10 | where a=7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks @micah in irc&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 19:00:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211149#M41571</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-08-22T19:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is event sampling possible using the REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211150#M41572</link>
      <description>&lt;P&gt;The following worked for me.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ splunk search 'index=_internal | stats count' -index_earliest 1493132552 -index_latest 1493404081 -sample_ratio 1000
INFO: Sampling disables usage of report acceleration summaries.
INFO: This search is sampling approximately 1 out of every 1000 events (seed=1317954456)
count
-----
   58





$ curl -sku user:pass &lt;A href="https://localhost:8089/services/search/jobs/export" target="test_blank"&gt;https://localhost:8089/services/search/jobs/export&lt;/A&gt; --data-urlencode search='search index=_internal | stats count' -d output_mode=csv -d earliest_time='1493132552' -d latest_time='1493404081' -d sample_ratio='1000'
count
46
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Apr 2017 18:48:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-event-sampling-possible-using-the-REST-API/m-p/211150#M41572</guid>
      <dc:creator>jrizzo_splunk</dc:creator>
      <dc:date>2017-04-28T18:48:41Z</dc:date>
    </item>
  </channel>
</rss>

