<?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 define time range of a saved search using Python SDK in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212940#M4467</link>
    <description>&lt;P&gt;I think you need to use scheduled_times and arguments to it as part of your kwargs&lt;/P&gt;

&lt;P&gt;From the Python SDK Docs for &lt;A href="http://docs.splunk.com/DocumentationStatic/PythonSDK/1.4.0/client.html#splunklib.client.SavedSearch"&gt;saved searches&lt;/A&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class splunklib.client.SavedSearch(service, path, **kwargs)
This class represents a saved search.



scheduled_times(earliest_time='now', latest_time='+1h') Returns the times when this search is scheduled to run.

By default this method returns the times in the next hour. For different time ranges, set earliest_time and latest_time. For example, for all times in the last day use “earliest_time=-1d” and “latest_time=now”.

Parameters:  earliest_time (string) – The earliest time. latest_time (string) – The latest time. Returns:    The list of search times.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Sep 2015 11:09:49 GMT</pubDate>
    <dc:creator>StewGoin1</dc:creator>
    <dc:date>2015-09-03T11:09:49Z</dc:date>
    <item>
      <title>How to define time range of a saved search using Python SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212938#M4465</link>
      <description>&lt;P&gt;I'm trying to create a saved search with following &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; kwargs = {                                                
    'description': 'failed auth',
    'is_scheduled' : True,
    'cron_schedule' : '*/5 * * * *',
    'start_time' : 'rt-5s@s',
    'end_time' : 'rt+5s@s'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It gives following error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;HTTPError: HTTP 400 Bad Request -- 
 In handler 'savedsearch': Argument "start_time" is not supported by this handler.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've also tried &lt;CODE&gt;earliest_time&lt;/CODE&gt; and &lt;CODE&gt;latest_time&lt;/CODE&gt; but with no luck. Please help.&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2015 08:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212938#M4465</guid>
      <dc:creator>debugger22</dc:creator>
      <dc:date>2015-09-03T08:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to define time range of a saved search using Python SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212939#M4466</link>
      <description>&lt;P&gt;&lt;EM&gt;Solved&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;kwargs = {                                                
     'description': 'failed auth',
     'is_scheduled' : True,
     'cron_schedule' : '*/5 * * * *',
     'dispatch.earliest_time' : 'rt-5s@s',
     'dispatch.latest_time' : 'rt+5s@s'
 }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Sep 2015 09:32:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212939#M4466</guid>
      <dc:creator>SIddharth5794</dc:creator>
      <dc:date>2015-09-03T09:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to define time range of a saved search using Python SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212940#M4467</link>
      <description>&lt;P&gt;I think you need to use scheduled_times and arguments to it as part of your kwargs&lt;/P&gt;

&lt;P&gt;From the Python SDK Docs for &lt;A href="http://docs.splunk.com/DocumentationStatic/PythonSDK/1.4.0/client.html#splunklib.client.SavedSearch"&gt;saved searches&lt;/A&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class splunklib.client.SavedSearch(service, path, **kwargs)
This class represents a saved search.



scheduled_times(earliest_time='now', latest_time='+1h') Returns the times when this search is scheduled to run.

By default this method returns the times in the next hour. For different time ranges, set earliest_time and latest_time. For example, for all times in the last day use “earliest_time=-1d” and “latest_time=now”.

Parameters:  earliest_time (string) – The earliest time. latest_time (string) – The latest time. Returns:    The list of search times.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Sep 2015 11:09:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212940#M4467</guid>
      <dc:creator>StewGoin1</dc:creator>
      <dc:date>2015-09-03T11:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to define time range of a saved search using Python SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212941#M4468</link>
      <description>&lt;P&gt;Instead of using as you did, the following will work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; kwargs = {                                                
      'description': 'failed auth',
      'is_scheduled' : True,
      'cron_schedule' : '*/5 * * * *',
      'dispatch.earliest_time' : 'rt-5s@s',
      'dispatch.latest_time' : 'rt+5s@s'
  }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Sep 2015 12:53:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/212941#M4468</guid>
      <dc:creator>SIddharth5794</dc:creator>
      <dc:date>2015-09-04T12:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to define time range of a saved search using Python SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/561563#M10901</link>
      <description>&lt;P&gt;This works for me. I plan to do more fine tuned filter.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;rr&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;results&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ResultsReader&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;service&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;jobs&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;export&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"search&amp;nbsp;host=App1&amp;nbsp;index=ftp&amp;nbsp;_indextime&amp;gt;=1627665310&amp;nbsp;_indextime&amp;lt;1627665313"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 30 Jul 2021 20:51:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-define-time-range-of-a-saved-search-using-Python-SDK/m-p/561563#M10901</guid>
      <dc:creator>jaywang66</dc:creator>
      <dc:date>2021-07-30T20:51:20Z</dc:date>
    </item>
  </channel>
</rss>

