<?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 pass a time range using API in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422285#M7432</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;In your query itself you can pass earliest and latest time. It will filter accordingly. Something like,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rr = results.ResultsReader(service.jobs.export("search index=_internal earliest=-1h | head 5"))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sid&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 18:52:42 GMT</pubDate>
    <dc:creator>sdchakraborty</dc:creator>
    <dc:date>2019-03-05T18:52:42Z</dc:date>
    <item>
      <title>How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422284#M7431</link>
      <description>&lt;P&gt;So I am using the Splunk SDK with Python 3.7.x (splunklib) and am trying to figure out how to ask for data in a certain time range. Right now I'm simply passing it a query, but when I try to pass time, it just ignores the range and sends me all the data for the last few months of data.&lt;/P&gt;

&lt;P&gt;Using this to run the job searches:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rr = results.ResultsReader(service.jobs.export(query))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I get data from a certain time range using the SDK?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 14:33:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422284#M7431</guid>
      <dc:creator>moe786</dc:creator>
      <dc:date>2019-03-05T14:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422285#M7432</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;In your query itself you can pass earliest and latest time. It will filter accordingly. Something like,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rr = results.ResultsReader(service.jobs.export("search index=_internal earliest=-1h | head 5"))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sid&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 18:52:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422285#M7432</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2019-03-05T18:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422286#M7433</link>
      <description>&lt;P&gt;Do I need to worry about stuff like the time format or having it in %H-%M-%S format or something?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 18:57:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422286#M7433</guid>
      <dc:creator>moe786</dc:creator>
      <dc:date>2019-03-05T18:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422287#M7434</link>
      <description>&lt;P&gt;I think you need to convert them to epoch format before you pass them to earliest or latest.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 19:09:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422287#M7434</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2019-03-05T19:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422288#M7435</link>
      <description>&lt;P&gt;So it would be earliest=-epochformedtime ?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 19:16:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422288#M7435</guid>
      <dc:creator>moe786</dc:creator>
      <dc:date>2019-03-05T19:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422289#M7436</link>
      <description>&lt;P&gt;when you are giving epoch for earliest and latest no need to give negative number.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 19:18:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422289#M7436</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2019-03-05T19:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422290#M7437</link>
      <description>&lt;P&gt;okay tyvm&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 19:38:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422290#M7437</guid>
      <dc:creator>moe786</dc:creator>
      <dc:date>2019-03-05T19:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422291#M7438</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;If you fine with the answer please accept it as answer. I have converted my comment as answer.&lt;/P&gt;

&lt;P&gt;Sid&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 05:31:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/422291#M7438</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2019-03-06T05:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a time range using API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/561562#M7439</link>
      <description>&lt;P&gt;This works for me. I plan to do more fine tune on the search filter.&lt;/P&gt;&lt;P&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;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 20:47:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-a-time-range-using-API/m-p/561562#M7439</guid>
      <dc:creator>jaywang66</dc:creator>
      <dc:date>2021-07-30T20:47:16Z</dc:date>
    </item>
  </channel>
</rss>

