<?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: How to search with join returns result in GUI, but not with Python SDK? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-search-with-join-returns-result-in-GUI-but-not-with/m-p/604857#M10703</link>
    <description>&lt;P&gt;Do you use the same user in GUI as with REST?&lt;/P&gt;&lt;P&gt;BTW, join over inputlookup doesn't seem to be the best idea. Why not straight use lookup?&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2022 20:38:12 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2022-07-07T20:38:12Z</dc:date>
    <item>
      <title>How to search with join returns result in GUI, but not with Python SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-search-with-join-returns-result-in-GUI-but-not-with/m-p/604848#M10702</link>
      <description>&lt;P&gt;I have a search that joins an index to a .csv lookup.&amp;nbsp; When I run the search for last 24 hours in the GUI, I get ~81k matches (expected).&amp;nbsp; When I run the exact same query via the sdk, I get 0 matches.&amp;nbsp; Here is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;service = client.connect(&lt;BR /&gt;host=HOST,&lt;BR /&gt;port=PORT,&lt;BR /&gt;username=USERNAME,&lt;BR /&gt;password=PASSWORD)&lt;/P&gt;
&lt;P&gt;import sys&lt;BR /&gt;from time import sleep&lt;BR /&gt;import splunklib.results as results&lt;/P&gt;
&lt;P&gt;query= "search index=my_index sourcetype=my_sourcetype | fields field1 field2 field3 field4 field5 field6 field7 | join my_primary_key[| inputlookup my_lookup_file.csv ]"&lt;BR /&gt;kwargs = {"exec_mode": "normal",&lt;BR /&gt;"earliest_time": "-1440m",&lt;BR /&gt;"latest_time": "now",&lt;BR /&gt;"search_mode": "normal",&lt;BR /&gt;"output_mode": "json"&lt;BR /&gt;}&lt;BR /&gt;job = service.jobs.create(query, **kwargs)&lt;/P&gt;
&lt;P&gt;# A normal search returns the job's SID right away, so we need to poll for completion&lt;BR /&gt;while True:&lt;BR /&gt;while not job.is_ready():&lt;BR /&gt;pass&lt;BR /&gt;stats = {"isDone": job["isDone"],&lt;BR /&gt;"doneProgress": float(job["doneProgress"])*100,&lt;BR /&gt;"scanCount": int(job["scanCount"]),&lt;BR /&gt;"eventCount": int(job["eventCount"]),&lt;BR /&gt;"resultCount": int(job["resultCount"])}&lt;/P&gt;
&lt;P&gt;status = ("\r%(doneProgress)03.1f%% %(scanCount)d scanned "&lt;BR /&gt;"%(eventCount)d matched %(resultCount)d results") % stats&lt;/P&gt;
&lt;P&gt;sys.stdout.write(status)&lt;BR /&gt;sys.stdout.flush()&lt;BR /&gt;if stats["isDone"] == "1":&lt;BR /&gt;sys.stdout.write("\n\nDone!\n\n")&lt;BR /&gt;break&lt;BR /&gt;sleep(2)&lt;BR /&gt;&lt;BR /&gt;# Get the results and display them&lt;BR /&gt;for result in results.JSONResultsReader(job.results(output_mode='json')):&lt;BR /&gt;print(result)&lt;/P&gt;
&lt;P&gt;job.cancel()&lt;BR /&gt;sys.stdout.write('\n')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can somebody please explain why the query would work and return matches in the GUI but not via the SDK?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 20:02:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-search-with-join-returns-result-in-GUI-but-not-with/m-p/604848#M10702</guid>
      <dc:creator>adomenico</dc:creator>
      <dc:date>2022-07-07T20:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to search with join returns result in GUI, but not with Python SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-search-with-join-returns-result-in-GUI-but-not-with/m-p/604857#M10703</link>
      <description>&lt;P&gt;Do you use the same user in GUI as with REST?&lt;/P&gt;&lt;P&gt;BTW, join over inputlookup doesn't seem to be the best idea. Why not straight use lookup?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 20:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-search-with-join-returns-result-in-GUI-but-not-with/m-p/604857#M10703</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-07-07T20:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to search with join returns result in GUI, but not with Python SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-search-with-join-returns-result-in-GUI-but-not-with/m-p/604942#M10704</link>
      <description>&lt;P&gt;Yes, it is the same user.&amp;nbsp; I need to join, because the lookup csv file contains part of the data I need in the final report and the index has the other part.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 13:23:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-search-with-join-returns-result-in-GUI-but-not-with/m-p/604942#M10704</guid>
      <dc:creator>adomenico</dc:creator>
      <dc:date>2022-07-08T13:23:43Z</dc:date>
    </item>
  </channel>
</rss>

