<?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 Search with Python SDK in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Search-with-Python-SDK/m-p/523712#M3708</link>
    <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I'm trying to run simple search via Python SDK (Python 3.8.5, splunk-sdk 1.6.14). Examples that are presented on&amp;nbsp;dev.splunk.com are clear but something goes wrong when I run search with my own parameters&lt;/P&gt;&lt;P&gt;The code is as simple as this&lt;/P&gt;&lt;PRE&gt;    search_kwargs_params = {&lt;BR /&gt;        &lt;SPAN&gt;"exec_mode"&lt;/SPAN&gt;: &lt;SPAN&gt;"blocking"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;"earliest_time"&lt;/SPAN&gt;: &lt;SPAN&gt;"2020-09-04T06:57:00.000-00:00"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;"latest_time"&lt;/SPAN&gt;: &lt;SPAN&gt;"2020-11-08T07:00:00.000-00:00"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;        &lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;    search_query = &lt;SPAN&gt;'search index=qwe1 trace=111-aaa-222 action=Event.OpenCase'&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    job = &lt;SPAN&gt;self&lt;/SPAN&gt;.service.jobs.create(search_query&lt;SPAN&gt;, &lt;/SPAN&gt;**search_kwargs_params)&lt;BR /&gt;    &lt;SPAN&gt;for &lt;/SPAN&gt;result &lt;SPAN&gt;in &lt;/SPAN&gt;results.ResultsReader(job.results()):&lt;BR /&gt;        &lt;SPAN&gt;print&lt;/SPAN&gt;(result)&lt;/PRE&gt;&lt;P&gt;But search returns no results. When I run same query manually in Splunk web GUI it works fine.&lt;/P&gt;&lt;P&gt;I've also tried to put all parameters in 'search_kwargs_params' dictionary, widened search time period and got some search results but they seem to be inappropriate to what I got in GUI.&lt;/P&gt;&lt;P&gt;Can someone advise?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2020 14:30:38 GMT</pubDate>
    <dc:creator>murat</dc:creator>
    <dc:date>2020-10-08T14:30:38Z</dc:date>
    <item>
      <title>Search with Python SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Search-with-Python-SDK/m-p/523712#M3708</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I'm trying to run simple search via Python SDK (Python 3.8.5, splunk-sdk 1.6.14). Examples that are presented on&amp;nbsp;dev.splunk.com are clear but something goes wrong when I run search with my own parameters&lt;/P&gt;&lt;P&gt;The code is as simple as this&lt;/P&gt;&lt;PRE&gt;    search_kwargs_params = {&lt;BR /&gt;        &lt;SPAN&gt;"exec_mode"&lt;/SPAN&gt;: &lt;SPAN&gt;"blocking"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;"earliest_time"&lt;/SPAN&gt;: &lt;SPAN&gt;"2020-09-04T06:57:00.000-00:00"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;"latest_time"&lt;/SPAN&gt;: &lt;SPAN&gt;"2020-11-08T07:00:00.000-00:00"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;        &lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;    search_query = &lt;SPAN&gt;'search index=qwe1 trace=111-aaa-222 action=Event.OpenCase'&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    job = &lt;SPAN&gt;self&lt;/SPAN&gt;.service.jobs.create(search_query&lt;SPAN&gt;, &lt;/SPAN&gt;**search_kwargs_params)&lt;BR /&gt;    &lt;SPAN&gt;for &lt;/SPAN&gt;result &lt;SPAN&gt;in &lt;/SPAN&gt;results.ResultsReader(job.results()):&lt;BR /&gt;        &lt;SPAN&gt;print&lt;/SPAN&gt;(result)&lt;/PRE&gt;&lt;P&gt;But search returns no results. When I run same query manually in Splunk web GUI it works fine.&lt;/P&gt;&lt;P&gt;I've also tried to put all parameters in 'search_kwargs_params' dictionary, widened search time period and got some search results but they seem to be inappropriate to what I got in GUI.&lt;/P&gt;&lt;P&gt;Can someone advise?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 14:30:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Search-with-Python-SDK/m-p/523712#M3708</guid>
      <dc:creator>murat</dc:creator>
      <dc:date>2020-10-08T14:30:38Z</dc:date>
    </item>
  </channel>
</rss>

