You can't start Splunk from the SDK because when Splunk is stopped, there is no running API. If splunkd
is not running, there is "no one home" for your code to talk to!
But you could write a script to execute these commands in the OS, and use your code to launch the script.
Thanks that helps ! I created a batch file with these commands.
You can't start Splunk from the SDK because when Splunk is stopped, there is no running API. If splunkd
is not running, there is "no one home" for your code to talk to!
But you could write a script to execute these commands in the OS, and use your code to launch the script.
Is there any way to get the status of splunkd service through sdk??
Basically rather than just restarting, I want to first stop then clean the index and then Start.
Actually, I want to do the equivalent of this using SDK.
Splunk stop
splunk clean eventdata -index default –f
splunk start
In python under splunklib.client you have the service class as well. From here you can use restart method to restart your splunkd instance.
In java or C# SDK, you have a class "Service" which contains a method Restart.