How to Automate Support Bundles

Create a script that automatically sends the support bundle utilizing the Unix crontab scheduler and scripting.

You can customize the script to identify where the location of the support bundle needs to be and the frequency of sending the bundle. 

All you need is a crontab & script file. 

Crontab 

  1. Set up a crontab
  2. Execute crontab -e 
  3. Add: 
0 1 * * * /put_location_of_the_script.sh 

#this means the file will be executed at 1 am daily 

Script 

Example script name: sendlog.sh 

Step 1. Create a directory of where the support bundle needs to go 

Step 2. Create a file sendlog.sh 

#add the new script here for the modeler log 

export jwt=`curl --insecure -s -X GET -u admin:"password" "http://localhost:10500/default/auth"` curl --insecure -o -H "Authorization:Bearer $jwt" /home/atscale/support/mycompany-`date +%Y-%m-%d`.zip http://localhost:10502/support/all?LogFiles.Window=1.day 

curl -X POST -F 'myfiles=@/home/atscale/support/mycompany-'`date +%Y-%m-%d`'.zip' --user atscale:atscale_upload https://upload.atscale.com/upload 

find /home/atscale/support/mycompany* -mtime +5 -exec rm {} \; 

find /opt/atscale/log/*/*.log* -mtime +5 -exec rm {} \;

 

Step 3. Update the script with the file's location and mycompany to easily identify where the support bundle comes from. To change the host/port #, contact the AtScale Admin for information about how they configured the AtScale ports/host. 

Step 4. Chmod sendlog.sh to be executable 

Step 5. Contact AtScale Tech Support and ask to verify if they received the file named <mycompany-[date]> 

 

Update the script depending on which AtScale version is deployed. You need to add these at the beginning of the script.

AtScale 2022.2 and earlier releases 

gzip -f /opt/atscale/log/modeler/Modeler.log 

mv /opt/atscale/log/modeler/Modeler.log.gz /opt/atscale/log/modeler/Modeler-`date +%Y-%m-%d`.gz 

touch /opt/atscale/log/modeler/Modeler.log

 

AtScale 2022.3 and later releases 

gzip -r /opt/atscale/log/modeler 

mkdir /opt/atscale/log/modeler/`date +%Y-%m-%d` 

mv /opt/atscale/log/modeler/*.gz `date +%Y-%m-%d` 

touch /opt/atscale/log/modeler/auth.http.log /opt/atscale/log/modeler/modeler.app.log /opt/atscale/log/modeler/modeler.http.log /opt/atscale/log/modeler/auth.app.log

 

Another option, with root access you can create a log rotation in /etc/logrotate.d

Create a file atscale-modeler 

/opt/atscale/log/modeler/Modeler.log { 

daily 

missingok 

rotate 24 

compress 

maxsize 1G 

notifempty 

copytruncate 

}

Was this article helpful?

0 out of 0 found this helpful