@@ -62,9 +62,10 @@ exec > /tmp/splunkconf-purgebackup-debug.log 2>&1
6262# 20251007 resync load settings with updated regex
6363# 20251215 add mode=purge to have more consistent logging
6464# 20251215 add timeout for curl command to speed up backup for on prem with firewalls
65+ # 20251216 more curl timeout
6566
6667
67- VERSION=" 20251215b "
68+ VERSION=" 20251216a "
6869
6970# ##### BEGIN default parameters
7071# dont change here, use the configuration file to override them
@@ -372,10 +373,10 @@ if [ $CHECK -ne 0 ]; then
372373 if [[ " cloud_type" -eq 1 ]]; then
373374 # aws
374375 # setting up token (IMDSv2)
375- TOKEN=` curl --silent --show-error -X PUT " http://169.254.169.254/latest/api/token" -H " X-aws-ec2-metadata-token-ttl-seconds: 900" `
376+ TOKEN=` curl --silent --show-error --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - X PUT " http://169.254.169.254/latest/api/token" -H " X-aws-ec2-metadata-token-ttl-seconds: 900" `
376377 # lets get the s3splunkinstall from instance tags
377- INSTANCE_ID=` curl --silent --show-error -H " X-aws-ec2-metadata-token: $TOKEN " http://169.254.169.254/latest/meta-data/instance-id `
378- REGION=` curl --silent --show-error -H " X-aws-ec2-metadata-token: $TOKEN " http://169.254.169.254/latest/meta-data/placement/availability-zone | sed ' s/.$//' `
378+ INSTANCE_ID=` curl --silent --show-error --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " X-aws-ec2-metadata-token: $TOKEN " http://169.254.169.254/latest/meta-data/instance-id `
379+ REGION=` curl --silent --show-error --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " X-aws-ec2-metadata-token: $TOKEN " http://169.254.169.254/latest/meta-data/placement/availability-zone | sed ' s/.$//' `
379380
380381 # we put store tags in instance-tags file-> we will use this later on
381382 aws ec2 describe-tags --region $REGION --filter " Name=resource-id,Values=$INSTANCE_ID " --output=text | sed -e ' s/^[[:space:]]*//' -e ' s/[[:space:]]*$//' -e ' s/[[:space:]]*=[[:space:]]*/=/' | sed -r ' s/TAGS\t(.*)\t.*\t.*\t(.*)/\1="\2"/' | grep -E " ^splunk" > $INSTANCEFILE
@@ -390,38 +391,38 @@ if [ $CHECK -ne 0 ]; then
390391 fi
391392elif [[ " cloud_type" -eq 2 ]]; then
392393 # GCP
393- splunkinstanceType=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunkinstanceType`
394+ splunkinstanceType=` curl ---connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunkinstanceType`
394395 if [ -z ${splunkinstanceType+x} ]; then
395396 debug_log " GCP : Missing splunkinstanceType in instance metadata"
396397 else
397398 # > to overwrite any old file here (upgrade case)
398399 echo -e " splunkinstanceType=${splunkinstanceType} \n" > $INSTANCEFILE
399400 fi
400- splunks3installbucket=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunks3installbucket`
401+ splunks3installbucket=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunks3installbucket`
401402 if [ -z ${splunks3installbucket+x} ]; then
402403 debug_log " GCP : Missing splunks3installbucket in instance metadata"
403404 else
404405 echo -e " splunks3installbucket=${splunks3installbucket} \n" >> $INSTANCEFILE
405406 fi
406- splunks3backupbucket=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunks3backupbucket`
407+ splunks3backupbucket=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunks3backupbucket`
407408 if [ -z ${splunks3backupbucket+x} ]; then
408409 debug_log " GCP : Missing splunks3backupbucket in instance metadata"
409410 else
410411 echo -e " splunks3backupbucket=${splunks3backupbucket} \n" >> $INSTANCEFILE
411412 fi
412- splunks3databucket=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunks3databucket`
413+ splunks3databucket=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunks3databucket`
413414 if [ -z ${splunks3databucket+x} ]; then
414415 debug_log " GCP : Missing splunks3databucket in instance metadata"
415416 else
416417 echo -e " splunks3databucket=${splunks3databucket} \n" >> $INSTANCEFILE
417418 fi
418- splunklocalbackupretentiondays=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupretentiondays`
419- splunklocalbackupkvretentiondays=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupkvretentiondays`
420- splunklocalbackupscriptsretentiondays=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupscriptsretentiondays`
421- splunklocalbackupstateretentiondays=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupstateretentiondays`
422- splunklocalbackupdir=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupdir`
423- splunklocalmaxsize=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalmaxsize`
424- splunklocalmaxsizeauto=` curl -H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalmaxsizeauto`
419+ splunklocalbackupretentiondays=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupretentiondays`
420+ splunklocalbackupkvretentiondays=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupkvretentiondays`
421+ splunklocalbackupscriptsretentiondays=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupscriptsretentiondays`
422+ splunklocalbackupstateretentiondays=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupstateretentiondays`
423+ splunklocalbackupdir=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalbackupdir`
424+ splunklocalmaxsize=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalmaxsize`
425+ splunklocalmaxsizeauto=` curl --connect-timeout $CURLCONNECTTIMEOUT --max-time $CURLMAXTIME - H " Metadata-Flavor: Google" -fs http://metadata/computeMetadata/v1/instance/attributes/splunklocalmaxsizeauto`
425426
426427else
427428 warn_log " aws cloud tag detection disabled (missing commands)"
0 commit comments