<?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 Why does stats  via python SDK export returns multiple sets of results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-stats-via-python-SDK-export-returns-multiple-sets-of/m-p/536897#M151777</link>
    <description>&lt;P&gt;I get a different result set when using &lt;EM&gt;jobs.export&lt;/EM&gt; of python SDK with a simple stats query compared to the same query (and time range) on the splunk UI.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the jobs.export returns a list of results of the following form, so there is a repeating pattern with several sets of "lastrow":true&amp;nbsp; and repeating "offset" almost as if partial results are included several times.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only the last set matches the final results of the query on the UI.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Schematically the results of this call:&lt;/P&gt;
&lt;P&gt;jobs.export("search my_id | stats count by index").read().decode('utf8').split('\n')&lt;/P&gt;
&lt;P&gt;have this form&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;['{"preview":true, "offset":0, "result": {"index": "index_a", "count":"2"}}',

'{"preview":true, "offset":1, "result": {"index": "index_b", "count":"4"}}',

'{"preview":true, "offset":2, "lastrow":true, "result": {"index": "index_b", "count":"4"}}',

'{"preview":true, "offset":0, "result": {"index": "index_a", "count":"6"}}',

'{"preview":true, "offset":1, "result": {"index": "index_b", "count":"12"}}',

'{"preview":true, "offset":2, "lastrow":true, "result": {"index": "index_b", "count":"50"}}',

'{"preview":true, "offset":0, "result": {"index": "index_a", "count":"18"}}',

'{"preview":true, "offset":1, "result": {"index": "index_b", "count":"102"}}',

'{"preview":true, "offset":2, "lastrow":true, "result": {"index": "index_b", "count":"499"}}',

'{"preview":true, "offset":0, "result": {"index": "index_a", "count":"18"}}',

'{"preview":true, "offset":1, "result": {"index": "index_b", "count":"102"}}',

'{"preview":true, "offset":2, "lastrow":true, "result": {"index": "index_b", "count":"499"}}',

]&lt;/LI-CODE&gt;
&lt;P&gt;the last couple of segments ending with "lastrow":true share the same count that matches that in the UI.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there some flag we need to insert in kwargs? currently using only earliest_time, latest_time, count:0 and sample_ratio:1&lt;/P&gt;</description>
    <pubDate>Sat, 23 Jan 2021 05:37:27 GMT</pubDate>
    <dc:creator>alancalvitti</dc:creator>
    <dc:date>2021-01-23T05:37:27Z</dc:date>
    <item>
      <title>Why does stats  via python SDK export returns multiple sets of results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-stats-via-python-SDK-export-returns-multiple-sets-of/m-p/536897#M151777</link>
      <description>&lt;P&gt;I get a different result set when using &lt;EM&gt;jobs.export&lt;/EM&gt; of python SDK with a simple stats query compared to the same query (and time range) on the splunk UI.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the jobs.export returns a list of results of the following form, so there is a repeating pattern with several sets of "lastrow":true&amp;nbsp; and repeating "offset" almost as if partial results are included several times.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only the last set matches the final results of the query on the UI.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Schematically the results of this call:&lt;/P&gt;
&lt;P&gt;jobs.export("search my_id | stats count by index").read().decode('utf8').split('\n')&lt;/P&gt;
&lt;P&gt;have this form&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;['{"preview":true, "offset":0, "result": {"index": "index_a", "count":"2"}}',

'{"preview":true, "offset":1, "result": {"index": "index_b", "count":"4"}}',

'{"preview":true, "offset":2, "lastrow":true, "result": {"index": "index_b", "count":"4"}}',

'{"preview":true, "offset":0, "result": {"index": "index_a", "count":"6"}}',

'{"preview":true, "offset":1, "result": {"index": "index_b", "count":"12"}}',

'{"preview":true, "offset":2, "lastrow":true, "result": {"index": "index_b", "count":"50"}}',

'{"preview":true, "offset":0, "result": {"index": "index_a", "count":"18"}}',

'{"preview":true, "offset":1, "result": {"index": "index_b", "count":"102"}}',

'{"preview":true, "offset":2, "lastrow":true, "result": {"index": "index_b", "count":"499"}}',

'{"preview":true, "offset":0, "result": {"index": "index_a", "count":"18"}}',

'{"preview":true, "offset":1, "result": {"index": "index_b", "count":"102"}}',

'{"preview":true, "offset":2, "lastrow":true, "result": {"index": "index_b", "count":"499"}}',

]&lt;/LI-CODE&gt;
&lt;P&gt;the last couple of segments ending with "lastrow":true share the same count that matches that in the UI.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there some flag we need to insert in kwargs? currently using only earliest_time, latest_time, count:0 and sample_ratio:1&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2021 05:37:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-stats-via-python-SDK-export-returns-multiple-sets-of/m-p/536897#M151777</guid>
      <dc:creator>alancalvitti</dc:creator>
      <dc:date>2021-01-23T05:37:27Z</dc:date>
    </item>
  </channel>
</rss>

