<?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: Limited results when running searches via REST API in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142192#M39414</link>
    <description>&lt;P&gt;Hi Tom,&lt;/P&gt;

&lt;P&gt;Thanks. In my case, whenever the offset is larger than the total number of records, i get a string of length 0.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jun 2015 16:33:54 GMT</pubDate>
    <dc:creator>karan1337</dc:creator>
    <dc:date>2015-06-05T16:33:54Z</dc:date>
    <item>
      <title>Limited results when running searches via REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142187#M39409</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to run a search and get the results back via REST API using python. The way i am trying to get the results is as follows:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;//query: searchquery = 'search index=indexname sourcetype=sourcetypename earliest=-5h'

do....the....query

services_search_results_str = '/services/search/jobs/%s/results?output_mode=raw&amp;amp;count=0' % sid
searchresults = myhttp.request(base_url + services_search_results_str, 'GET')[1]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where base_url points to our splunk instance on a server. However, irrespective of the earliest time i specify, i always end up getting the first 50000 results even though i have more than 600,000 events for 1 hr and approximately 5 times of that number in 5 hours. Am i missing something? Is there a way to get the complete set of events?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 01:43:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142187#M39409</guid>
      <dc:creator>karan1337</dc:creator>
      <dc:date>2015-06-04T01:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Limited results when running searches via REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142188#M39410</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;this is from the limits.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[restapi]
maxresultrows = &amp;lt;integer&amp;gt;
* Maximum result rows to be returned by /events or /results getters from REST API.
* Defaults to 50000.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, there is a limit configured.&lt;/P&gt;

&lt;P&gt;You have two options now:&lt;/P&gt;

&lt;P&gt;1) Enhance the limit to a value that is suitable for you.&lt;BR /&gt;
2) I think the better option is to repeat your call with a different offset. You split up your requests on this way. Take a look into the answer of this post:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/25411/upper-limit-for-rest-api-limits-conf-maxresultrows.html"&gt;http://answers.splunk.com/answers/25411/upper-limit-for-rest-api-limits-conf-maxresultrows.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Greetings,&lt;/P&gt;

&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 09:13:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142188#M39410</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2015-06-04T09:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Limited results when running searches via REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142189#M39411</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;

&lt;P&gt;Thanks for the reply. So if i choose to repeat my calls, is there a way to check the total number of records returned before processing them? That way, i would know exactly how many splits i will have to make and set the offset accordingly. &lt;/P&gt;

&lt;P&gt;A follow up question is that if i provide an offset that is larger than the total number of records that exist, what does the REST API return?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 16:01:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142189#M39411</guid>
      <dc:creator>karan1337</dc:creator>
      <dc:date>2015-06-04T16:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Limited results when running searches via REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142190#M39412</link>
      <description>&lt;P&gt;| rest /services/search/jobs count=0 splunk_server=local |head 1&lt;BR /&gt;
to  Limited results to display use &lt;CODE&gt;head&lt;/CODE&gt; command like: &lt;CODE&gt;...| head integer&lt;/CODE&gt;&lt;BR /&gt;
ex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rest /services/search/jobs/%s/results output_mode=raw count=0|head 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to have more results (set count give you  maximum number of entries to return set value to zero to get all available entries. )&lt;BR /&gt;
set &lt;CODE&gt;count&lt;/CODE&gt;(count=30 to default) and &lt;CODE&gt;offset&lt;/CODE&gt;(offset=0 to default)&lt;BR /&gt;
ex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rest /services/search/jobs/%s/results output_mode=raw count=600,000 offset=6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;BR /&gt;
 services_search_results_str = '/services/search/jobs/%s/results?output_mode=raw&amp;amp;count=0&amp;amp;offset=0' % sid&lt;BR /&gt;
 searchresults = myhttp.request(base_url + services_search_results_str, 'GET')&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:07:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142190#M39412</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2020-09-28T20:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Limited results when running searches via REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142191#M39413</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;from my point of view, i would just do the calls with an static offset, for example 10,000. After every call, i would check the amount of returned events for this split. As soon as there are less than 10,000 results, i do not need to do an additional call. Therefore, you do not have to calculate the amount of splits.&lt;/P&gt;

&lt;P&gt;For your last question: i would just test it, since i do not know how the api responds in this case &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Greetings&lt;/P&gt;

&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2015 09:25:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142191#M39413</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2015-06-05T09:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Limited results when running searches via REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142192#M39414</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;

&lt;P&gt;Thanks. In my case, whenever the offset is larger than the total number of records, i get a string of length 0.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2015 16:33:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142192#M39414</guid>
      <dc:creator>karan1337</dc:creator>
      <dc:date>2015-06-05T16:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Limited results when running searches via REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142193#M39415</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;

&lt;P&gt;I am facing another issue which is something similar. Can you please look at: &lt;A href="http://answers.splunk.com/answers/252047/rest-api-search-and-gui-search-are-inconsistent.html"&gt;http://answers.splunk.com/answers/252047/rest-api-search-and-gui-search-are-inconsistent.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2015 22:45:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limited-results-when-running-searches-via-REST-API/m-p/142193#M39415</guid>
      <dc:creator>karan1337</dc:creator>
      <dc:date>2015-06-24T22:45:29Z</dc:date>
    </item>
  </channel>
</rss>

