<?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 Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488682#M83616</link>
    <description>&lt;P&gt;Hi Community,&lt;BR /&gt;
I'm trying to extract search results using REST API and I'm facing the following problem. &lt;BR /&gt;
1. I'm using the curl command: &lt;CODE&gt;curl --location --request POST 'https://XXXXXX/services/search/jobs/export' \ --data-urlencode 'search=search index=uam user="abcd" event=auth earliest="01/16/2020:00:00:00" latest=now() | eval access_time=strftime(_time, "%Y-%d-%m %H:%M:%S") |  stats count by access_time user status |  fields - count' \ --data-urlencode 'output_mode=json'&lt;/CODE&gt;. The results I get are different every time I fire up the API. Sometime there are 10 results, sometimes 20, 15, and so on; i.e. inconsistent.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;When I use the same searchquery in the Splunk UI, I get the reults, which are different from the results i get from the API call, which is desired. Search result I use is: &lt;CODE&gt;index=uam user="abcd" event=auth earliest="01/16/2020:00:00:00" latest=now() | eval access_time=strftime(_time, "%Y-%d-%m %H:%M:%S") |  stats count by access_time user status |  fields - count&lt;/CODE&gt;.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Along with that, when i get back the json results, there is a field "preview" which have values "true" or "false", I assume that the results with &lt;STRONG&gt;preview: true&lt;/STRONG&gt; might be shown in the Splunk UI. &lt;/P&gt;

&lt;P&gt;Result from the API call:&lt;BR /&gt;
`{&lt;BR /&gt;
    "preview": true,&lt;BR /&gt;
    "offset": 9,&lt;BR /&gt;
    "result": {&lt;BR /&gt;
        "access_time": "2020-15-01 18:06:21",&lt;BR /&gt;
        "user": "adcgwjv_ahubt_ext1",&lt;BR /&gt;
        "status": "success"&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;{&lt;BR /&gt;
    "preview": false,&lt;BR /&gt;
    "offset": 9,&lt;BR /&gt;
    "result": {&lt;BR /&gt;
        "access_time": "2020-15-01 18:06:21",&lt;BR /&gt;
        "user": "adcgwjv_ahubt_ext1",&lt;BR /&gt;
        "status": "success"&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;BR /&gt;
`&lt;/P&gt;

&lt;P&gt;Even after using &lt;CODE&gt;| dedup access_time&lt;/CODE&gt;, i get the repeated results on API call, but works fine in the Splunk UI.&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Sid&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:44:55 GMT</pubDate>
    <dc:creator>siddharth1479</dc:creator>
    <dc:date>2020-09-30T03:44:55Z</dc:date>
    <item>
      <title>Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488682#M83616</link>
      <description>&lt;P&gt;Hi Community,&lt;BR /&gt;
I'm trying to extract search results using REST API and I'm facing the following problem. &lt;BR /&gt;
1. I'm using the curl command: &lt;CODE&gt;curl --location --request POST 'https://XXXXXX/services/search/jobs/export' \ --data-urlencode 'search=search index=uam user="abcd" event=auth earliest="01/16/2020:00:00:00" latest=now() | eval access_time=strftime(_time, "%Y-%d-%m %H:%M:%S") |  stats count by access_time user status |  fields - count' \ --data-urlencode 'output_mode=json'&lt;/CODE&gt;. The results I get are different every time I fire up the API. Sometime there are 10 results, sometimes 20, 15, and so on; i.e. inconsistent.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;When I use the same searchquery in the Splunk UI, I get the reults, which are different from the results i get from the API call, which is desired. Search result I use is: &lt;CODE&gt;index=uam user="abcd" event=auth earliest="01/16/2020:00:00:00" latest=now() | eval access_time=strftime(_time, "%Y-%d-%m %H:%M:%S") |  stats count by access_time user status |  fields - count&lt;/CODE&gt;.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Along with that, when i get back the json results, there is a field "preview" which have values "true" or "false", I assume that the results with &lt;STRONG&gt;preview: true&lt;/STRONG&gt; might be shown in the Splunk UI. &lt;/P&gt;

&lt;P&gt;Result from the API call:&lt;BR /&gt;
`{&lt;BR /&gt;
    "preview": true,&lt;BR /&gt;
    "offset": 9,&lt;BR /&gt;
    "result": {&lt;BR /&gt;
        "access_time": "2020-15-01 18:06:21",&lt;BR /&gt;
        "user": "adcgwjv_ahubt_ext1",&lt;BR /&gt;
        "status": "success"&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;{&lt;BR /&gt;
    "preview": false,&lt;BR /&gt;
    "offset": 9,&lt;BR /&gt;
    "result": {&lt;BR /&gt;
        "access_time": "2020-15-01 18:06:21",&lt;BR /&gt;
        "user": "adcgwjv_ahubt_ext1",&lt;BR /&gt;
        "status": "success"&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;BR /&gt;
`&lt;/P&gt;

&lt;P&gt;Even after using &lt;CODE&gt;| dedup access_time&lt;/CODE&gt;, i get the repeated results on API call, but works fine in the Splunk UI.&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Sid&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:44:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488682#M83616</guid>
      <dc:creator>siddharth1479</dc:creator>
      <dc:date>2020-09-30T03:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488683#M83617</link>
      <description>&lt;P&gt;Anytime I use &lt;CODE&gt;latest=now()&lt;/CODE&gt; I expect differing results. How can the UI results be different all together and desired? Feels like some information is missing about how the data is different. For the sake of comparing apples to apples, fix your time frames and do not make them relative.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 16:27:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488683#M83617</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2020-01-17T16:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488684#M83618</link>
      <description>&lt;P&gt;Hi, Thanks for the reply. Using &lt;CODE&gt;latest=new()&lt;/CODE&gt; or &lt;CODE&gt;latest="01/17/2020:11:00:00"&lt;/CODE&gt;, the results are inconsistent in both the cases.&lt;/P&gt;

&lt;P&gt;And for the missing information, I've edited the post with some more insights.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 16:36:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488684#M83618</guid>
      <dc:creator>siddharth1479</dc:creator>
      <dc:date>2020-01-17T16:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488685#M83619</link>
      <description>&lt;P&gt;Bear in mind that when you dispatch a search via UI you are having RBAC applied as well as KOs from the App Context you are in.&lt;/P&gt;

&lt;P&gt;When you dispatch a search via REST, you might not be executing the search in the correct name space (servicesNS/user/app/) or you may be executing as a different role.&lt;/P&gt;

&lt;P&gt;Please see docs about servicesNS endpoints and try using the same app &amp;amp; user context with your curl command.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 17:54:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488685#M83619</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-01-17T17:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488686#M83620</link>
      <description>&lt;P&gt;Can you elaborate more? I'm fairly new to Splunk and learning to operate. Is there any link i can refer? Also in the above given curl command, can you point out that part of it are you talking about? &lt;/P&gt;

&lt;P&gt;Thanks for the help @jkat54.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 18:09:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488686#M83620</guid>
      <dc:creator>siddharth1479</dc:creator>
      <dc:date>2020-01-17T18:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488687#M83621</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/RESTTUT/RESTsearches"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/RESTTUT/RESTsearches&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Follow the above and your problem should go away.&lt;/P&gt;

&lt;P&gt;You're currently getting results from "services/search/jobs/export" and you should be using something like "services/search/jobs/SID/results" instead&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 20:32:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488687#M83621</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-01-17T20:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488688#M83622</link>
      <description>&lt;P&gt;This is what you're currently doing: &lt;/P&gt;

&lt;P&gt;search/jobs/export&lt;BR /&gt;
&lt;A href="https://:/services/search/jobs/export" target="test_blank"&gt;https://:/services/search/jobs/export&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;"Stream search results as they become available."&lt;/P&gt;

&lt;P&gt;Which is why the results keep changing / "duplicating".&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 20:34:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488688#M83622</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-01-17T20:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488689#M83623</link>
      <description>&lt;P&gt;Yes, now I got to know what you're talking about and what caused the duplication. Thanks for the insights.&lt;/P&gt;

&lt;P&gt;So now that you told that, we need to look for "SID" to obtain the results, what i did is created a chained API call which takes sid from one POST call "/services/search/jobs" which gives SID and the using this SID, in to GET call "/services/search/{{sid}}/results".&lt;/P&gt;

&lt;P&gt;But again, my question is; Is there anyway which can make this single call or simpler logic for this results generation?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Sid&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 17:59:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488689#M83623</guid>
      <dc:creator>siddharth1479</dc:creator>
      <dc:date>2020-01-21T17:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488690#M83624</link>
      <description>&lt;P&gt;You can make the search a scheduled report in splunk and then call the latest results of the scheduled report each time instead.&lt;/P&gt;

&lt;P&gt;This would have 2 benefits.   It would give fast results with less calls to the API, and it can help reduce&lt;BR /&gt;
the load your code would place on the system.  Since you'd always get the results of the last run, you wouldn't be running new searches all the time with your code.  &lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 18:07:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488690#M83624</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-01-21T18:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488691#M83625</link>
      <description>&lt;P&gt;That's a great idea. You will get almost a real=time solution and also make it more proficient.&lt;/P&gt;

&lt;P&gt;Thanks for all the help.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 21:21:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488691#M83625</guid>
      <dc:creator>siddharth1479</dc:creator>
      <dc:date>2020-01-21T21:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488692#M83626</link>
      <description>&lt;P&gt;Anytime!!!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 12:01:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/488692#M83626</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-01-22T12:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistency between search results between Splunk UI and Rest API &amp; REST API itself</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/744498#M118306</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/199197"&gt;@jkat54&lt;/a&gt;&amp;nbsp;Hello, I find out I get lastTime tstats metadata from export api endpoint ran from CLI and not getting this lastTime field on web search with same query, even if lastTime info is from last year from offline UF. I guess there is maybe web filtering. This only applies to single result though.&lt;/P&gt;&lt;P&gt;Results can be different I guess due to different user/role, app context, api endpoint which may be my case.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 16:43:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Inconsistency-between-search-results-between-Splunk-UI-and-Rest/m-p/744498#M118306</guid>
      <dc:creator>splunkreal</dc:creator>
      <dc:date>2025-04-18T16:43:01Z</dc:date>
    </item>
  </channel>
</rss>

