Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helpers/getmycredentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ KEY=$3
FI="mykey-${REGION}.priv"

if [ -e "$FI" ]; then
echo "$FI already exist , wont attempt to overwrite it !!!! Please remove with care if you really want to update"
echo "$FI already exists , wont attempt to overwrite it !!!! Please remove with care if you really want to update"
echo " result would have been :"
aws secretsmanager get-secret-value --secret-id $KEY --query "SecretString" --output text --region $REGION
echo "SSM"
Expand Down
6 changes: 3 additions & 3 deletions helpers/tftopology.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ for i in instance-*.tf; do
echo "i=$i ."
t=instances-template/${i}
if [ -e $t ]; then
echo "ERROR $t already exist, unable to move file $i, that is unexpected, both files should not be present at same time"
echo "ERROR $t already exists, unable to move file $i, that is unexpected, both files should not be present at same time"
status=1
#exit 1
else
Expand Down Expand Up @@ -113,7 +113,7 @@ if [[ $MODE -eq "2" ]]; then
t=instances-template/$i
if [ -e "$t" ]; then
if [ -e "$i" ]; then
echo "ERROR $i already exist, unable to move file $t, that is unexpected, both files should not be present at same time"
echo "ERROR $i already exists, unable to move file $t, that is unexpected, both files should not be present at same time"
status=1
#exit 1
else
Expand Down Expand Up @@ -149,7 +149,7 @@ elif [[ $MODE -eq "1" ]]; then
t=instances-template/$i
if [ -e "$t" ]; then
if [ -e "$i" ]; then
echo "ERROR $i already exist, unable to move file $t, that is unexpected, both files should not be present at same time"
echo "ERROR $i already exists, unable to move file $t, that is unexpected, both files should not be present at same time"
status=1
#exit 1
else
Expand Down
16 changes: 8 additions & 8 deletions splunkconf-backup/bin/splunkconf-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ exec > /tmp/splunkconf-backup-debug.log 2>&1
# 20191018 correct exit codes to have ES checks happy, change version test to less depend on external command, change manageport detection that dont work on all env, reduce tar kvstore loop try as we have kvdump
# 20200304 add logic for more generic /etc/instance-tags for non aws case + more logging improvements and move lots of logging to debug levea, fix statelist var in log message
# 20200309 disable old tar kvstore when doing kvdump, more logging improvements
# 20200314 add restore lock check to avoid launching a backup while a restore is still running (big kvdump for example) (may be theorically possible but add load to kvstore and not really make sense)
# 20200314 add restore lock check to avoid launching a backup while a restore is still running (big kvdump for example) (may be theoretically possible but add load to kvstore and not really make sense)
# 20200318 add ability to pass parameter for specific backup only in order to do more fine grained scheduling
# 20200502 change disk space check to not exit immediately in order to report more info for backup that are missing (to be used for reporting logic)
# 20200502 make code more modular, improve logging for full etc case, add disabled apps dir to targeted etc, set umask explicitely, change check for kvstore remote copy
Expand Down Expand Up @@ -154,7 +154,7 @@ exec > /tmp/splunkconf-backup-debug.log 2>&1
# 20251216 more curl timeout
# 20251217 propage script autodisable status so remote copy status is always aligned
# 20251218 improve remote copy and disabled modes to prevent useless retries which add unecessary logging
# 20251219 propagate error from local to remote to avoid logging disabled when it is a failure du to local (like disk space issue)
# 20251219 propagate error from local to remote to avoid logging disabled when it is a failure due to local (like disk space issue)
# 20260105 update time logging format
# 20260324 add more debug logging for remotebackup
# 20260324 update condition fro unconfigured s3
Expand Down Expand Up @@ -185,7 +185,7 @@ SPLUNK_HOME=`cd ../../..;pwd`
# debug -> verify the env that splunk set (python version may affect aws command for example,...)
#env
# unsetting env to not depend on splunk python version
# this is because we may call aws command which is in python itself and can break du to this
# this is because we may call aws command which is in python itself and can break due to this
unset LD_LIBRARY_PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin
unset PYTHONHASHSEED
Expand All @@ -205,7 +205,7 @@ CURLMAXTIME=60

# we always do relative backup but if ever you want the old way, change mode below to abs
# recovery part support both mode
# du to recent tar behavior related to exclusion it is better to use rel mode
# due to recent tar behavior related to exclusion it is better to use rel mode
TARMODE="rel"
# this is the form that gets added in name if the backup was made relative to splunk home
# otherwise no extension
Expand Down Expand Up @@ -422,7 +422,7 @@ function splunkconf_purgebackup {
function splunkconf_checkspace {
CURRENTAVAIL=`df --output=avail -k ${LOCALBACKUPDIR} | tail -1`
if [[ ${MINFREESPACE} -gt ${CURRENTAVAIL} ]]; then
# we dont report the error here in normal case as it will be reported with nore info by the local backup functions
# we dont report the error here in normal case as it will be reported with more info by the local backup functions
debug_log "action=checkdiskfree mode=$MODE, minfreespace=${MINFREESPACE}, currentavailable=${CURRENTAVAIL} type=localdiskspacecheck reason=insufficientspaceleft result=fail ERROR : Insufficient disk space left , disabling backups ! Please fix "
ERROR=1
ERROR_MESS="localdiskspacecheck"
Expand Down Expand Up @@ -459,7 +459,7 @@ function check_cloud() {
cloud_type=1
fi
fi
# if detection not yet successfull, try fallback method
# if detection not yet successful, try fallback method
if [[ $cloud_type -eq "0" ]]; then
# Fallback check of http://169.254.169.254/. If we wanted to be REALLY
# authoritative, we could follow Amazon's suggestions for cryptographically
Expand Down Expand Up @@ -710,7 +710,7 @@ function do_remote_copy() {
break
else
# not nornal, we still log a failure even if not the last attempt
# note this can fail du to timeout if qos or lack of ressources on s3 or server
# note this can fail due to timeout if qos or lack of ressources on s3 or server
fail_log "action=backup type=${TYPE} object=${OBJECT} result=failure src=${LFIC} dest=${RFIC} durationms=${DURATION} size=${FILESIZE} err=$RES ATTEMPT=$ATTEMPT MAXTRY=$REMOTECOPYRETRY"
fi
fi
Expand Down Expand Up @@ -1396,7 +1396,7 @@ if [ ! -d "$LOCALBACKUPDIR" ]; then
exit 1;
fi
else
debug_log "OK: backup dir $LOCALBACKUPDIR already exist"
debug_log "OK: backup dir $LOCALBACKUPDIR already exists"
fi

if [ ! -w $LOCALBACKUPDIR ] ; then
Expand Down
4 changes: 2 additions & 2 deletions splunkconf-backup/bin/splunkconf-checkbackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SPLUNK_HOME=`cd ../../..;pwd`
# debug -> verify the env that splunk set (python version may affect aws command for example,...)
#env
# undetting env to not depend on splunk python version
# this is because we may call aws command which is in python itself and can break du to this
# this is because we may call aws command which is in python itself and can break due to this
unset LD_LIBRARY_PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin
unset PYTHONHASHSEED
Expand All @@ -55,7 +55,7 @@ CURLMAXTIME=60

##### LOCAL

# Used for checking that backup is more recent than this value, dont forget to add a margin related to backup frequency as the backup time may change slightly even if theorically running at same time
# Used for checking that backup is more recent than this value, dont forget to add a margin related to backup frequency as the backup time may change slightly even if theoretically running at same time
BACKUPRECENCY=86500

LOCALBACKUPDIR="${SPLUNK_HOME}/var/backups"
Expand Down
6 changes: 3 additions & 3 deletions splunkconf-backup/bin/splunkconf-purgebackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exec > /tmp/splunkconf-purgebackup-debug.log 2>&1
# 20200421 improve logging
# 20201105 add test for default and local conf file to prevent error appearing in logs
# 20220326 add support for rel and zstd types by relaxing form detection
# 20220326 change starving condition to fail even if that is probably du to external condition in order to try to be more visible that we have a problem + only log when all the types have been tried
# 20220326 change starving condition to fail even if that is probably due to external condition in order to try to be more visible that we have a problem + only log when all the types have been tried
# 20220327 improve logging by adding freespace info
# 20230704 add rcp purge support
# 20230913 add more debug log for system local conf file
Expand Down Expand Up @@ -186,7 +186,7 @@ function fail_log {
function splunkconf_checkspace {
CURRENTAVAIL=`df --output=avail -k ${LOCALBACKUPDIR} | tail -1`
if [[ ${MINFREESPACE} -gt ${CURRENTAVAIL} ]]; then
# we dont report the error here in normal case as it will be reported with nore info by the local backup functions
# we dont report the error here in normal case as it will be reported with more info by the local backup functions
debug_log "mode=$MODE, minfreespace=${MINFREESPACE}, currentavailable=${CURRENTAVAIL} type=localdiskspacecheck reason=insufficientspaceleft action=checkdiskfree result=fail ERROR : Insufficient disk space left , disabling backups ! Please fix "
ERROR=1
ERROR_MESS="localdiskspacecheck"
Expand Down Expand Up @@ -238,7 +238,7 @@ function check_cloud() {
cloud_type=1
fi
fi
# if detection not yet successfull, try fallback method
# if detection not yet successful, try fallback method
if [[ $cloud_type -eq "0" ]]; then
# Fallback check of http://169.254.169.254/. If we wanted to be REALLY
# authoritative, we could follow Amazon's suggestions for cryptographically
Expand Down
6 changes: 3 additions & 3 deletions splunkconf-backup/bin/splunkconf-restorebackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ exec > /tmp/splunkconf-restore-debug.log 2>&1
# 20251201 rework version detection, update with the one from backup to change the logic to be consistent (help with v10)
# 20251202 align load settings with backup version
# 20251215 remove version check for kvdump, assuming always version at minimum 7.1
# 20251215 add backup dir creation to avoid error and delay du to check disk space not working correctly
# 20251215 add backup dir creation to avoid error and delay due to check disk space not working correctly
# 20251215 add timeout for curl command to speed up backup for on prem with firewalls
# 20251219 add failure log for backup in disk space situation at first start in order to fill dashboard from start with correct info
# 20260105 update time logging format
Expand Down Expand Up @@ -111,7 +111,7 @@ SPLUNK_HOME=`cd ../../..;pwd`
# debug -> verify the env that splunk set (python version may affect aws command for example,...)
#env
# unsetting env to not depend on splunk python version
# this is because we may call aws command which is in python itself and can break du to this
# this is because we may call aws command which is in python itself and can break due to this
unset LD_LIBRARY_PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin
unset PYTHONHASHSEED
Expand Down Expand Up @@ -397,7 +397,7 @@ if [ ! -d "$LOCALBACKUPDIR" ]; then
exit 1;
fi
else
debug_log "OK: backup dir $LOCALBACKUPDIR already exist"
debug_log "OK: backup dir $LOCALBACKUPDIR already exists"
fi

if [ ! -w $LOCALBACKUPDIR ] ; then
Expand Down
4 changes: 2 additions & 2 deletions src/installes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# 20200412 add version check to autoadapt to the version and keep one single script for all versions, add prompt to continue installation and try to run all conditions even when failure to have the admin build faster the list of all things to fix, move some messages to debug log level
# 20200416 add sha256 for ES 6.1.1 and make it default
# 20200508 add sha256 for ES6.2, use more relaxed regex for final check as the log sligthly changed with latest versions
# 20200629 fix shc test for ES content update, add ESINSTALLERNFORCENOTA and remove TA options fron essinstall for 6.2. change default to 6.2
# 20200629 fix shc test for ES content update, add ESINSTALLERNFORCENOTA and remove TA options from essinstall for 6.2. change default to 6.2
# 20201103 add version var + fix typo in message
# 20201123 add sha for es6.4
# 20201215 update sha for 6.4 as the build was updated
Expand Down Expand Up @@ -319,7 +319,7 @@ fi
# folder will always contain README
if [[ $(/usr/bin/find ${SPLUNK_HOME}/etc/shcluster/apps |wc -l) >2 ]]; then
SHC=1
echo "looks like we may be running on a SHC deployer, shc install mode prefered for ES5.3+ "
echo "looks like we may be running on a SHC deployer, shc install mode preferred for ES5.3+ "
else
SHC=0
echo "deployer not detected. Using default sh mode"
Expand Down
6 changes: 3 additions & 3 deletions src/setcgroup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
# Matthieu Araman, Splunk

# This script test cgroup version and will reconfigure it in v1 compatibility mode if v2 is used
# This need to be done only for Splunk versions not supporting cgroupv2 (as when cgroupv2 will be supported , it will allow WLM to leverage cgroupv2 only functionalities)
# This need a reboot to be taken into account
# This needs to be done only for Splunk versions not supporting cgroupv2 (as when cgroupv2 will be supported , it will allow WLM to leverage cgroupv2 only functionalities)
# This needs a reboot to be taken into account

# script return code
# 0 = all good
# 1 = need reboot

# 20240316 extract cgroup logic fron splunkconf-cloud-recovery. sh in a specific script to make it easier to use outside recovery
# 20240316 extract cgroup logic from splunkconf-cloud-recovery. sh in a specific script to make it easier to use outside recovery

cgroup_status () {
NEEDCGROUPDISABLED=0
Expand Down
6 changes: 3 additions & 3 deletions src/setcgroupv2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
# Matthieu Araman, Splunk

# This script test cgroup version and will reconfigure it in v1 compatibility mode if v2 is used
# This need to be done only for Splunk versions not supporting cgroupv2 (as when cgroupv2 will be supported , it will allow WLM to leverage cgroupv2 only functionalities)
# This need a reboot to be taken into account
# This needs to be done only for Splunk versions not supporting cgroupv2 (as when cgroupv2 will be supported , it will allow WLM to leverage cgroupv2 only functionalities)
# This needs a reboot to be taken into account

# script return code
# 0 = all good
# 1 = need reboot

# 20240316 extract cgroup logic fron splunkconf-cloud-recovery. sh in a specific script to make it easier to use outside recovery
# 20240316 extract cgroup logic from splunkconf-cloud-recovery. sh in a specific script to make it easier to use outside recovery
# 20240805 version to force cgroup to v2 when possible

cgroup_status () {
Expand Down
Loading