Deployment Architecture

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

Path Finder

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:-

if test -f "$FILE"; then
echo "$FILE exist"
rm -fr "$FILE"
ls -lt "$FILE"
/opt/splunkforwarder/bin/splunk restart

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

exit 0

contents for inputs.conf
interval = -1

0 Karma


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

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

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

Path Finder

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

0 Karma
Get Updates on the Splunk Community!

Admin Your Splunk Cloud, Your Way

Join us to maximize different techniques to best tune Splunk Cloud. In this Tech Enablement, you will get ...

Cloud Platform | Discontinuing support for TLS version 1.0 and 1.1

Overview Transport Layer Security (TLS) is a security communications protocol that lets two computers, ...

New Customer Testimonials

Enterprises of all sizes and across different industries are accelerating cloud adoption by migrating ...