<?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: Splunk Api query returns inconsistent results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Api-query-returns-inconsistent-results/m-p/284827#M190690</link>
    <description>&lt;P&gt;Thanks for your reply. I will change the stats and give a try.&lt;/P&gt;

&lt;P&gt;Userid1,2,3.. is an example. it can be value of anything like "rob","john","123ad"...&lt;/P&gt;</description>
    <pubDate>Sat, 19 Dec 2015 16:15:33 GMT</pubDate>
    <dc:creator>cse9423</dc:creator>
    <dc:date>2015-12-19T16:15:33Z</dc:date>
    <item>
      <title>Splunk Api query returns inconsistent results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Api-query-returns-inconsistent-results/m-p/284825#M190688</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I am getting inconsistent results from splunk for below queries.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;query1:
search index=index01 AND status=success AND (userid=user1 OR userid=user2 or userid=user3.... till userid=user50) | stats values(userid), values(ip)  by ip

query2:
search index=index01 AND status=success AND (userid=user1 OR userid=user2 or userid=user3) | stats values(userid, values(ip)  by ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(basically i have less number of userid in the query2).&lt;/P&gt;

&lt;P&gt;The first query returns 3 records for user1 which is not correct and the second query returns 5 records for user1 which is correct.&lt;/P&gt;

&lt;P&gt;I am using splunk 1.3.2 jar to execute these queries. Any help greatly appreciated.&lt;/P&gt;

&lt;P&gt;Here is code snippet,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;JobArgs job = new JobArgs();
jobar.setExecutonMode(JobAgs.ExecutionMode.Blocking);
jobar.setLatestTime(latesttime); //latesttime: yesterday
jobar.setEarliestTime(earliesttime) //earliesttime: yesterday - 10days

Service service = getSplunkServiceConnection();
Job job = service.getJobs.create(query, jobar);
while (!job.isDone()){
   try{
        Thread.sleep(500);
   } catch(InterrruptedExecption e){
  }
}

// process the result
JobResultsArgs  result = new JobResultsArgs();
result.setOutputMode(OutputMode.JSON);
InputStream resultstream = job.getResults(result);
ResultsReader resultreader = new ResultsReaderJson(resultstream);
while(HashMap&amp;lt;String,String&amp;gt; event = resultreader.getNextEvent()) ! = null){
  String ip = event.get("ip");
  String id = event.get("userid");
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Dec 2015 19:54:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Api-query-returns-inconsistent-results/m-p/284825#M190688</guid>
      <dc:creator>cse9423</dc:creator>
      <dc:date>2015-12-18T19:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Api query returns inconsistent results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Api-query-returns-inconsistent-results/m-p/284826#M190689</link>
      <description>&lt;P&gt;It sounds like you're exceeding the limits of the &lt;CODE&gt;stats&lt;/CODE&gt; command (50000 events by default).  I would increase the limit and use userid=* instead if you want to search for them all.  You could do userid&amp;lt;51 to get the first 50 too.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/Admin/Limitsconf"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/Admin/Limitsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Please note the following when handling limits.conf in a distributed environment:&lt;BR /&gt;
    # limits.conf settings and DISTRIBUTED SEARCH&lt;BR /&gt;
    #   Unlike most settings which affect searches, limits.conf settings are not&lt;BR /&gt;
    #   provided by the search head to be used by the search peers.  This means&lt;BR /&gt;
    #   that if you need to alter search-affecting limits in a distributed&lt;BR /&gt;
    #   environment, typically you will need to modify these settings on the&lt;BR /&gt;
    #   relevant peers and search head for consistent results.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 22:31:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Api-query-returns-inconsistent-results/m-p/284826#M190689</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2015-12-18T22:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Api query returns inconsistent results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Api-query-returns-inconsistent-results/m-p/284827#M190690</link>
      <description>&lt;P&gt;Thanks for your reply. I will change the stats and give a try.&lt;/P&gt;

&lt;P&gt;Userid1,2,3.. is an example. it can be value of anything like "rob","john","123ad"...&lt;/P&gt;</description>
      <pubDate>Sat, 19 Dec 2015 16:15:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Api-query-returns-inconsistent-results/m-p/284827#M190690</guid>
      <dc:creator>cse9423</dc:creator>
      <dc:date>2015-12-19T16:15:33Z</dc:date>
    </item>
  </channel>
</rss>

