Deployment Architecture

Can we restart a splunkforwarder in linux box by calling a script in inputs.conf?

saurabh009
Path Finder

Hi,
I am trying switch deployment server.
In order to do that, I am trying to push an app having deploymentclient.conf pointing to the new deployment server and inputs.conf which triggers a script.
That script removes deploymentclient.conf from "system/local" but it could't restart the splunkforwarder to take new deploymentclient.conf(app/local/deloymentclient.conf) to take effect.
Script causing the forwarder to stop and never comes back.
Below are the contents for script:-

FILE=/opt/splunkforwarder/etc/system/local/deploymentclient.conf
if test -f "$FILE"; then
echo "$FILE exist"
rm -fr "$FILE"
ls -lt "$FILE"
sleep60
/opt/splunkforwarder/bin/splunk restart

else
echo "$FILE no more exist" 1>&2
fi

exit 0

contents for inputs.conf
[script://./bin/dsconfig.sh]
interval = -1

0 Karma

jnudell_2
Builder

As ddrillic said, you can use the deployment server to do this. You can create a "dummy" app, or push the app that you have the script in.

In the UI: Click on settings -> Forwarder Management
Click the Apps tab
Click Edit next to your "dummy" app or app that contains the script
In the top make sure the checkbox is checked off for Restart Splunkd and add it to a serverclass that will push the app to your target client.

This should deploy the app, and restart splunkd afterwards.

0 Karma

saurabh009
Path Finder

I don't want to deploy second app to restart the splunk forwarder.
App which is intended to remove the deploymentclient.conf should also do the restart of splunkforwarder second time after the app deployment restart the forwarder.

0 Karma

ddrillic
Ultra Champion

Just keep in mind that in serverclass.conf there is the restartSplunkd capability -

restartSplunkd = true | false
* If true, restarts splunkd on the client when a member app or a directly
configured app is updated.
* Can be overridden at the serverClass level and the serverClass:app level.
* Defaults to false

It's being used also for a restart of a set of forwarders, when needed.

0 Karma

saurabh009
Path Finder

I am trying to restart second time after the app gets deployed via script.

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In September, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...