<?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 Scripted input not creating last event file in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Scripted-input-not-creating-last-event-file/m-p/428052#M74983</link>
    <description>&lt;P&gt;I'm trying to create a script within a custom add-on that runs daily to pull data from an API endpoint. One of the arguments of the request is "from" which is a &lt;CODE&gt;%Y-%m-%d&lt;/CODE&gt; string. My script is running successfully (the correct events exist after it runs), but the file for tracking the last event isn't being created. I've ran the script manually from the command line of my Splunk host and the file is created then, so I know that it should work. The python file has 555 permissions and is owned by splunk:splunk. Are there any steps that aren't obvious that I could be missing? &lt;/P&gt;

&lt;P&gt;Here is the segment that should create the file:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;with open(last_date_path, 'w') as file:
    file.write(str(date.today() - timedelta(days=1)))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Mar 2019 19:44:37 GMT</pubDate>
    <dc:creator>wyattfg</dc:creator>
    <dc:date>2019-03-11T19:44:37Z</dc:date>
    <item>
      <title>Scripted input not creating last event file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Scripted-input-not-creating-last-event-file/m-p/428052#M74983</link>
      <description>&lt;P&gt;I'm trying to create a script within a custom add-on that runs daily to pull data from an API endpoint. One of the arguments of the request is "from" which is a &lt;CODE&gt;%Y-%m-%d&lt;/CODE&gt; string. My script is running successfully (the correct events exist after it runs), but the file for tracking the last event isn't being created. I've ran the script manually from the command line of my Splunk host and the file is created then, so I know that it should work. The python file has 555 permissions and is owned by splunk:splunk. Are there any steps that aren't obvious that I could be missing? &lt;/P&gt;

&lt;P&gt;Here is the segment that should create the file:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;with open(last_date_path, 'w') as file:
    file.write(str(date.today() - timedelta(days=1)))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Mar 2019 19:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Scripted-input-not-creating-last-event-file/m-p/428052#M74983</guid>
      <dc:creator>wyattfg</dc:creator>
      <dc:date>2019-03-11T19:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Scripted input not creating last event file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Scripted-input-not-creating-last-event-file/m-p/428053#M74984</link>
      <description>&lt;P&gt;Think I found the solution. &lt;CODE&gt;last_date_path&lt;/CODE&gt; should include the entire directory structure like this: &lt;CODE&gt;os.path.join(os.environ["SPLUNK_HOME"], "etc", "apps", "&amp;lt;APP_NAME&amp;gt;", "bin", &amp;lt;LAST_DATE_FILENAME&amp;gt;)&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 14:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Scripted-input-not-creating-last-event-file/m-p/428053#M74984</guid>
      <dc:creator>wyattfg</dc:creator>
      <dc:date>2019-03-13T14:46:37Z</dc:date>
    </item>
  </channel>
</rss>

