Splunk Dev

Is there a way for my app to run a Python function on server start?

matutter4
Explorer

I want Splunk to run my script when the server starts & stops. Of course I can write a custom shell script to launch Splunk & do that by hand, but is there a way to have my App run on startup?

0 Karma

thejeffreystone
Path Finder

You could create a modular input using the python SDK. It is not really hard. Here is a basic example: https://github.com/kospol/splunk_simplePythonModularInput

Then your script can just be an app inside splunk.

0 Karma

matutter4
Explorer

Thanks, this was helpful. But really what I'm looking for is way to execute something from an "appserver" app. I have a bunch of views which need to be changed by a python script when I do a splunk restartss

0 Karma

thejeffreystone
Path Finder

If you are on *nix, then you might be able to edit /etc/init.d/splunk

I suspect if you run 'splunk enable boot-start' you will overwrite your changes though. But in there you could add your script to the splunk_start(), and splunk_restart()

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

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, ...