<?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: search/jobs/export not returning valid JSON in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/search-jobs-export-not-returning-valid-JSON/m-p/71424#M14524</link>
    <description>&lt;P&gt;please read this answer on the same subject.&lt;BR /&gt;
&lt;A href="http://splunk-base.splunk.com/answers/65932/rest-api-json-invalid-format"&gt;http://splunk-base.splunk.com/answers/65932/rest-api-json-invalid-format&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Dec 2012 22:45:47 GMT</pubDate>
    <dc:creator>yannK</dc:creator>
    <dc:date>2012-12-27T22:45:47Z</dc:date>
    <item>
      <title>search/jobs/export not returning valid JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/search-jobs-export-not-returning-valid-JSON/m-p/71423#M14523</link>
      <description>&lt;P&gt;After upgrade to Splunk 5, search/jobs/export stopped returning valid JSON on request. Upon inspection, I see that it returns preview results in addition to the final one.&lt;/P&gt;

&lt;P&gt;How do I make it return only finalized result?&lt;/P&gt;

&lt;P&gt;I tried adding "exec_mode=oneshot" in the post data, but this has no effect. I tried adding the same thing in the search string, but instead of getting only final result, the search is finalized before I get full results.&lt;/P&gt;

&lt;P&gt;Here are some examples of correct results, but invalid json (this happens with or without exe_mode set in post data):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"7.451046943"}}
{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"72.3570270548"}}
{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"462.3673467760"}}
{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"730.9158630706"}}
{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"942.3713274259"}}
{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"1089.2731590699"}}
{"preview":false,"offset":0,"lastrow":true,"result":{"sum(MB)":"1089.2731590699"}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the result when I run the same query with exec_mode=oneoff in the search string itself:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"7.343144416"}}
{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"71.4846410748"}}
{"preview":true,"offset":0,"lastrow":true,"result":{"sum(MB)":"209.8987865451"}}
{"preview":false,"offset":0,"lastrow":true,"result":{"sum(MB)":"209.8987865451"}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Splitting the result by new line, and then grabbing only the last one is not an option, as most of the searches that I have to do through the API run for an hour or so, and produce massive resultset.&lt;/P&gt;

&lt;P&gt;Let me know if additional information is needed.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2012 20:57:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/search-jobs-export-not-returning-valid-JSON/m-p/71423#M14523</guid>
      <dc:creator>opticsplanet</dc:creator>
      <dc:date>2012-12-21T20:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: search/jobs/export not returning valid JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/search-jobs-export-not-returning-valid-JSON/m-p/71424#M14524</link>
      <description>&lt;P&gt;please read this answer on the same subject.&lt;BR /&gt;
&lt;A href="http://splunk-base.splunk.com/answers/65932/rest-api-json-invalid-format"&gt;http://splunk-base.splunk.com/answers/65932/rest-api-json-invalid-format&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2012 22:45:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/search-jobs-export-not-returning-valid-JSON/m-p/71424#M14524</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2012-12-27T22:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: search/jobs/export not returning valid JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/search-jobs-export-not-returning-valid-JSON/m-p/71425#M14525</link>
      <description>&lt;P&gt;According to this: &lt;A href="http://dev.splunk.com/view/splunk-python-sdk-how-to/SP-CAAAEE5"&gt;http://dev.splunk.com/view/splunk-python-sdk-how-to/SP-CAAAEE5&lt;/A&gt;, exec_mode=oneshot should make it a valid JSON, but it does not work.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2012 22:51:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/search-jobs-export-not-returning-valid-JSON/m-p/71425#M14525</guid>
      <dc:creator>opticsplanet</dc:creator>
      <dc:date>2012-12-27T22:51:43Z</dc:date>
    </item>
  </channel>
</rss>

