Deployment Architecture

Script to reload serverclasses that use a specified deployment-app

satyenshah
Path Finder

It's inconvenient that a Splunk deployment-server cannot reload an 'app'. It only reloads a 'serverclass'. Here's a shortcut.

The following bash script takes the name of a deployment-app as a parameter. It will reload serverclasses that use the deployment-app. Copy the script to your Deployment Server to make it easier to push out app changes to clients from the CLI.

#!/bin/bash

if [ $# -lt 1 ]; then
  echo 1>&2 "$0: not enough arguments"
  exit 2
elif [ $# -gt 1 ]; then
  echo 1>&2 "$0: too many arguments"
  exit 2
elif (! (grep -E -q "^\[serverClass:[^:]*:app:$1" /opt/splunk/etc/system/local/serverclass.conf )); then
  echo 1>&2 "$0: No serverclasses found for $1"
  exit 0
fi

grep -E "^\[serverClass:[^:]*:app:$1" /opt/splunk/etc/system/local/serverclass.conf | cut -d':' -f2 | sed -E 's/^(.*)$/ -class \1/g' | tr -d '\n' | xargs echo sudo -H -u splunkserviceaccount /opt/splunk/bin/splunk reload deploy-server -auth admin:changeme

read -p "Press [Enter] to execute above command..."

grep -E "^\[serverClass:[^:]*:app:$1" /opt/splunk/etc/system/local/serverclass.conf | cut -d':' -f2 | sed -E 's/^(.*)$/ -class \1/g' | tr -d '\n' | xargs sudo -H -u splunkserviceaccount /opt/splunk/bin/splunk reload deploy-server -auth admin:changeme
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...