Skip to content

Instantly share code, notes, and snippets.

@subfission
Last active August 6, 2018 18:29
Show Gist options
  • Save subfission/968a2cd615702bb8c8041d8e89da5b0f to your computer and use it in GitHub Desktop.
Save subfission/968a2cd615702bb8c8041d8e89da5b0f to your computer and use it in GitHub Desktop.
Splunk UniversalForwarder 7.0.0 Downloader for RedHat
#!/bin/bash
# Downloader script for Splunk Universal Forwarder
#
# Usage:
# bash forwardsplunker.sh
#
version="7.0.0" # Splunk product Version
hash="c8a78efdd40f" # Versioned HASH
# --- Dont edit below ---
filename="splunkforwarder-${version}-${hash}-linux-2.6-x86_64.rpm"
cd ~
mkdir SplunkDownloader
cd SplunkDownloader
echo "Downloading Splunk PGP Public Key..."
curl -O "https://docs.splunk.com/images/6/6b/SplunkPGPKey.pub"
rpm --import "SplunkPGPKey.pub"
echo "Downloading Splunk..."
rpm -i "https://download.splunk.com/products/universalforwarder/releases/${version}/linux/${filename}"
splunk_path="/opt/splunkforwarder"
echo "Adding bash completions"
source "${splunk_path}/bin/setSplunkEnv"
echo "export SPLUNK_HOME=/opt/splunkforwarder" >> ~/.bash_profile
echo 'export PATH=$SPLUNK_HOME/bin:$PATH' >> ~/.bash_profile
echo "Enabling boot-start"
$splunk_path/bin/splunk enable boot-start -user splunk --accept-license --no-prompt --answer-yes
echo "Housekeeping..."
rm -rf ~/SplunkDownloader
chown -R splunk:splunk $splunk_path
echo "Setting up permissions..."
setfacl -Rdm g:splunk:rx /var/log
setfacl -Rm g:splunk:rx /var/log
setfacl -Rdm g:splunk:rx /usr/local/apache/logs
setfacl -Rm g:splunk:rx /usr/local/apache/logs
echo "Splunk Config Path: /opt/splunkforwarder/etc/system/local"
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment