Getting Data In

Scripted input not creating last event file

wyattfg
Engager

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 %Y-%m-%d 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?

Here is the segment that should create the file:

with open(last_date_path, 'w') as file:
    file.write(str(date.today() - timedelta(days=1)))
0 Karma
1 Solution

wyattfg
Engager

Think I found the solution. last_date_path should include the entire directory structure like this: os.path.join(os.environ["SPLUNK_HOME"], "etc", "apps", "<APP_NAME>", "bin", <LAST_DATE_FILENAME>).

View solution in original post

0 Karma

wyattfg
Engager

Think I found the solution. last_date_path should include the entire directory structure like this: os.path.join(os.environ["SPLUNK_HOME"], "etc", "apps", "<APP_NAME>", "bin", <LAST_DATE_FILENAME>).

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...