How to create Jira Support Zip via command line

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

When Jira web interface, the UI, is not working properly, running and getting the Support Zip is a challenge, requiring Jira or the System administrator to collect logs and data from the Operating System.

To facilitate it, this solution comes to automatize the log/data search and packaging using the same structure the Support Zip tool provides beyond other benefits.

Solution

Environment and requirements

The solution runs in Linux based Operating System with:

  • /bin/bash

  • zip and/or gzip applications

To run in Windows the OS might have:

  • Powershell

It's also required by the system administrator:

  • Being familiar with the Operating System command line interface.

  • Recognize the Jira Home and Jira Application folders.

  • Have read permission on Jira Home and Jira Application folders (recommended root/Administrator or the Jira user if using Linux).

⚠️ Attention: when using Jira Data Center with multiple nodes, the script shall be run in each node separately and the home folder refers to the Jira home from the node (not the shared home folder). Also, before running the scripts, ensure there is enough disk space on node-home/export for the data transfer and zip creation!

Script and its usage

Below you may find the scripts, usage, and real examples for Linux and Windows.

Linux

Script

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 #!/bin/bash ###################### # supportzip.sh # Author: Douglas Alves - dalves@atlassian.com in behalf of Atlassian Customer Success team # Atlassian doc: # https://confluence.atlassian.com/x/BZgBQw # Versioning: # 0.1 20220324 - Initial version # 0.2 20220328 - Password sanitization # 1.0 20220419 - Added thread dump # 1.1 20240912 - Changed the path for the jfr # To-do: # Consult perf data (DB latency, OS, etc) ###################### USER=`whoami` WHEREAMI=`pwd` DATE=`date +%Y-%m-%d-%H-%M-%S` TD=0 ########THE OPTIONS##### usage() { echo "Usage: $0 [-h <jira home path>] [-a <jira app path>] -t -h: obligatory, absolute path of jira home directory -a: obligatory, absolute path of jira application directory -t: optional, to run and collect thread dumps" 1>&2; exit 1; } while getopts ":a:h:t" o; do case $o in h|H) h=${OPTARG} ;; a|A) a=${OPTARG} ;; t|T) TD=1 ;; *) usage ;; esac done if [ -z $h ] || [ -z $a ]; then usage fi ###############THE PATHS JIRAAPP=$a JIRAHOME=$h BEXPORT=$JIRAHOME/export LOG=$BEXPORT/Jira_support_$DATE.log EXPORT=$BEXPORT/Jira_support_$DATE echo ' __ ------------------------------------------ _(\ |@@| | Beep - Generating Atlassian Support Zip | (__/\__ \--/ __ /_------------------------------------------ \___|----| | __ \ }{ /\ )_ / _\ /\__/\ \__O (__ (--/\--) \__/ _)( )(_ `---''---` ' echo " ############################## # Atlassian support zip tool # ############################## User = $USER Jira Home = $JIRAHOME Jira App = $JIRAAPP Hit CTRL+C (10s wait) if any path or user is incorrect. " sleep 10 echo "`date +%Y-%m-%d-%H-%M-%S` - Start creating the Support Zip file" >> $LOG #Create the basic structure mkdir -p $EXPORT/{application-properties,healthchecks,tomcat-config,application-config,auth-cfg,thread-dump,tomcat-logs,application-logs,cache-cfg,tomcat-access-logs,cluster-nodes} #application-logs echo ' - Packing application logs' echo "`date +%Y-%m-%d-%H-%M-%S` - application-logs" >> $LOG cp -rf $JIRAHOME/log/* $EXPORT/application-logs/ # application-config #Jira configuration files echo ' - Packing application config files' echo "`date +%Y-%m-%d-%H-%M-%S` - application-config" >> $LOG cat $JIRAHOME/dbconfig.xml | sed 's/\<password\>.*/\<password\>Sanitized by Support Utility\<\/password\>/g' | sed 's/\<username\>.*/\<username\>Sanitized by Support Utility\<\/username\>/g' > $EXPORT/application-config/dbconfig.xml cp -f $JIRAAPP/atlassian-jira/WEB-INF/classes/{entityengine.xml,log4j.properties} $EXPORT/application-config/ cp -f $JIRAAPP/bin/{setclasspath.sh,setenv.sh,shutdown.sh,start-jira.sh,startup.sh,stop-jira.sh} $EXPORT/application-config/ for i in setclasspath.sh setenv.sh shutdown.sh start-jira.sh startup.sh stop-jira.sh ; do tmp=`echo $i | sed 's/\./-/g'`; mv $EXPORT/application-config/$i $EXPORT/application-config/$tmp.txt; done #auth-cfg #If exists <jira-home>/logs/support (possibly will gather old data) will grab the file however changing name to avoid confusion echo ' - Packing configuration summary, if any available' echo "`date +%Y-%m-%d-%H-%M-%S` - auth-cfg" >> $LOG if [ -f $JIRAHOME/logs/support/directoryConfigurationSummary.txt ]; then echo ' - Packing the last directoryConfigurationSummary available.' cat $JIRAHOME/logs/support/directoryConfigurationSummary.txt | sed 's/password:.*/password: Sanitized by Support Utility/g' > $EXPORT/auth-cfg/`ls -l $JIRAHOME/logs/support/directoryConfigurationSummary.txt | awk -F' ' '{print $6"-"$7}'`.directoryConfigurationSummary.txt; fi #tomcat-access-logs #Get last 5 days logs echo ' - Packing Tomcat access logs' echo "`date +%Y-%m-%d-%H-%M-%S` - tomcat-access-logs" >> $LOG find $JIRAAPP/logs/access_log* -type f -mtime -10 -exec cp -a "{}" $EXPORT/tomcat-access-logs \; >/dev/null #cache-cfg echo ' - Packing cache configuration files' echo "`date +%Y-%m-%d-%H-%M-%S` - cache-cfg" >> $LOG cp -f $JIRAAPP/atlassian-jira/WEB-INF/classes/*cache.prop* $EXPORT/cache-cfg #tomcat-config echo ' - Packing tomcat configuration files' echo "`date +%Y-%m-%d-%H-%M-%S` - tomcat-config" >> $LOG cp -f $JIRAAPP/conf/* $EXPORT/tomcat-config #sanitization cd $EXPORT/tomcat-config; cat server.xml | sed 's/keystorePass=\".*\"/keystorePass=\"Sanitized by Support Utility\"/g' | sed "s/keystorePass=\'.*\'/keystorePass=\'Sanitized by Support Utility\'/g" > server.xml.tmp; mv -f server.xml.tmp server.xml cd $EXPORT/tomcat-config; cat tomcat-users.xml | sed 's/password=\".*\"/password=\"Sanitized by Support Utility\"/g' > tomcat-users.xml.tmp; mv -f tomcat-users.xml.tmp tomcat-users.xml #healthchecks #If exists <jira-home>/logs/support (possibly will gather old data) will grab the file however changing name to avoid confusion echo ' - Packing healthcheckResults, if any available' echo "`date +%Y-%m-%d-%H-%M-%S` - healthchecks" >> $LOG if [ -f $JIRAHOME/logs/support/healthcheckResults.txt ]; then cp -f $JIRAHOME/logs/support/healthcheckResults.txt $EXPORT/healthchecks/`ls -l $JIRAHOME/logs/support/healthcheckResults.txt | awk -F' ' '{print $6"-"$7}'`.healthcheckResults.txt; fi #tomcat-logs echo ' - Packing Tomcat logs' echo "`date +%Y-%m-%d-%H-%M-%S` - tomcat-logs" >> $LOG find $JIRAAPP/logs -type f \( ! -iname "access_log*" \) -mtime -10 -exec cp -a "{}" $EXPORT/tomcat-logs \; #application-properties #If exists <jira-home>/logs/support (possibly will gather old data) will grab the file however changing name to avoid confusion echo ' - Packing the application.xml, if any available' echo "`date +%Y-%m-%d-%H-%M-%S` - application-properties" >> $LOG if [ -f $JIRAHOME/logs/support/application.xml ]; then cp -f $JIRAHOME/logs/support/application.xml $EXPORT/application-properties/`ls -l $JIRAHOME/logs/support/application.xml | awk -F' ' '{print $6"-"$7}'`.application.xml; fi #thread-dump if [ $TD == 1 ] then echo ' - Generating thread dumps - this will take ~1 minute' echo "`date +%Y-%m-%d-%H-%M-%S` - thread dump" >> $LOG APP_PID=`ps aux | grep -i jira | grep -i java | awk -F '[ ]*' '{print $2}'`; for i in $(seq 6); do top -b -H -p $APP_PID -n 1 > $EXPORT/thread-dump/threaddump_`date +%s`_cpu_usage.txt; jstack $APP_PID > $EXPORT/thread-dump/threaddump_`date +%s`.tdump; sleep 10; done else echo ' - Thread dump will not be collected' echo "`date +%Y-%m-%d-%H-%M-%S` - no thread dump" >> $LOG fi #move jfr data to root folder if [ -d $EXPORT/application-logs/jfr ]; then echo ' - Moving stuff around' mv $EXPORT/application-logs/jfr $EXPORT/jfr-bundle fi #Pack and go if [ -x "$(command -v zip)" ] ; then echo; echo 'Creating zip file...' echo "`date +%Y-%m-%d-%H-%M-%S` - Packing as zip" >> $LOG cd $EXPORT zip -r ../Jira_support_$DATE.zip ./* 2>&1 >> $LOG; echo; echo "The support zip file can be found in $BEXPORT/Jira_support_$DATE.zip, please upload this file to Atlassian." echo "." echo "Have a g'day =)" echo else echo; echo 'Zip not found, packing as tar.gz...' echo "`date +%Y-%m-%d-%H-%M-%S` - Zip not found, packing as tar.gz" >> $LOG cd $BEXPORT; tar -cvf Jira_support_$DATE.tar $EXPORT/*; gzip Jira_support_$DATE.tar 2>&1 >> $LOG; echo; echo "The support zip file can be found in $BEXPORT/Jira_support_$DATE.tar.gz, please upload this file to Atlassian." echo "." echo "Have a g'day =)" echo fi #EOF

Usage

The basic script shall be run as follows:

./supportzip.sh [-h <jira home path>] [-a <jira app path>]

With details:

1 2 3 4 5 # ./supportzip.sh -h Usage: ./supportzip.sh [-h <jira home path>] [-a <jira app path>] -t -h: obligatory, absolute path of jira home directory -a: obligatory, absolute path of jira application directory -t: optional, to collect thread dumps

Example

Below you may find an example of running the script using Linux and paths:

  • Node home folder (-h) "/opt/atlassian/jira/jira-home", and

  • Application folder (-a) "/opt/atlassian/jira/atlassian-jira-software-8.20.6-standalone"

The script call shall be set as (the "-t" is optional to generate thread dumps):

./supportzip.sh -h /opt/atlassian/jira/jira-home -a /opt/atlassian/jira/atlassian-jira-software-8.20.6-standalone -t

With details:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 # ./supportzip.sh -h /opt/atlassian/jira/jira-home -a /opt/atlassian/jira/atlassian-jira-software-8.20.6-standalone -t __ ------------------------------------------ _(\ |@@| | Beep - Generating Atlassian Support Zip | (__/\__ \--/ __ /_------------------------------------------ \___|----| | __ \ }{ /\ )_ / _\ /\__/\ \__O (__ (--/\--) \__/ _)( )(_ `------` ############################## # Atlassian support zip tool # ############################## User = jirauser Jira Home = /opt/atlassian/jira/jira-home/ Jira App = /opt/atlassian/jira/atlassian-jira-software-8.20.6-standalone/ Hit CTRL+C (10s wait) if any path or user is incorrect. - Packing application logs - Packing application config files - Packing configuration summary, if any available - Packing Tomcat access logs - Packing cache configuration files - Packing tomcat configuration files - Packing healthcheckResults, if any available - Packing Tomcat logs - Packing the application.xml, if any available - Generating thread dumps - this will take ~1 minute Creating zip file... The support zip file can be found in /opt/atlassian/jira/jira-home/export/Jira_support_2022-04-19-10-20-48.zip, please upload this file to Atlassian. . Have a g'day =)

Windows

Script

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 ###################### # supportzip.sh # Author: Douglas Alves - dalves@atlassian.com in behalf of Atlassian Customer Success team # Atlassian doc: # https://confluence.atlassian.com/x/BZgBQw # Versioning: # 0.1 20220324 - Initial version for Linux # 0.2 20220328 - Password sanitization # 1.0 20220419 - Linux Added thread dump # W1.0 202306 - Ported for Windows Power Shell ###################### param( [Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)] [System.String] $a, [Parameter(Mandatory=$True, Position=1, ValueFromPipeline=$false)] [System.String] $h ) $JIRAHOME=$h $JIRAAPP=$a $DATE=(get-date -f yyyy-MM-dd_hh-mm) if ( !(Test-Path -Path $h) -or !(Test-Path -Path $a)) { echo "Usage: .\supportzip.ps1 [-h <jira home path>] [-a <jira app path>] -h: obligatory, absolute path of jira home directory -a: obligatory, absolute path of jira application directory" exit 1 } $IAM = whoami $BEXPORT="$JIRAHOME/export" $LOG="$BEXPORT/Jira_support.log" $EXPORT="$BEXPORT/Jira_support_zip_$DATE" echo "" echo " __ ------------------------------------------" echo " _(\ |@@| | Beep - Generating Atlassian Support Zip |" echo "(__/\__ \--/ __ /_------------------------------------------" echo " \___|----| | __" echo " \ }{ /\ )_ / _\" echo " /\__/\ \__O (__" echo " (--/\--) \__/" echo " _)( )(_" echo " `---''---`" echo "." echo "." echo "##############################" echo "# Atlassian support zip tool #" echo "##############################" echo "$DATE" echo "Jira Home = $JIRAHOME" echo "Jira App = $JIRAAPP" echo "Current user = $IAM" echo "." echo "Hit CTRL+C (10s wait) if any path or user is incorrect." sleep 10 #Create the basic structure echo " - Creating basic structure" echo " .... " mkdir $EXPORT > $null cd $EXPORT mkdir application-properties,healthchecks,tomcat-config,application-config,auth-cfg,thread-dump,tomcat-logs,application-logs,cache-cfg,tomcat-access-logs,cluster-nodes > $null echo " .... " #application-logs echo " - Packing application logs" cp $JIRAHOME/log/* $EXPORT/application-logs/ # application-config #Jira configuration files echo ' - Packing application config files' (Get-Content $JIRAHOME/dbconfig.xml) -replace '<username>.+','<username>Sanitized by Support Utility</username>' -replace '<password>.+','<password>Sanitized by Support Utility</password>' > $EXPORT/application-config/dbconfig.xml cp $JIRAAPP/atlassian-jira/WEB-INF/classes/entityengine.xml $EXPORT/application-config/ cp $JIRAAPP/atlassian-jira/WEB-INF/classes/log4j.properties $EXPORT/application-config/ cp $JIRAAPP/bin/* $EXPORT/application-config/ #auth-cfg #If exists <jira-home>/logs/support (possibly will gather old data) will grab the file however changing name to avoid confusion echo ' - Packing configuration summary, if any available' if(Test-Path -Path $JIRAHOME/logs/support/directoryConfigurationSummary.txt -PathType Leaf) { echo ' - Packing the last directoryConfigurationSummary available.' cp $JIRAHOME/logs/support/directoryConfigurationSummary.txt $EXPORT/auth-cfg/ } else { echo ' -- Last directoryConfigurationSummary does not exist. Leaving.' } #tomcat-access-logs #Get tomcat logs echo ' - Packing all Tomcat logs' #cp $JIRAAPP/logs/access_log* $EXPORT/tomcat-access-logs/ cp $JIRAAPP/logs/* $EXPORT/tomcat-access-logs/ #cache-cfg echo ' - Packing cache configuration files' cp $JIRAAPP/atlassian-jira/WEB-INF/classes/*cache.prop* $EXPORT/cache-cfg #tomcat-config echo ' - Packing tomcat configuration files' cp $JIRAAPP/conf/* $EXPORT/tomcat-config/ #sanitization (Get-Content $EXPORT/tomcat-config/server.xml) -replace 'keystorePass=".+"','keystorePass=<sanitized_by_support>' | Set-Content $EXPORT/tomcat-config/server.xml (Get-Content $EXPORT/tomcat-config/tomcat-users.xml) -replace 'password=".+"','password="sanitized_by_Support' | Set-Content $EXPORT/tomcat-config/tomcat-users.xml #healthchecks #If exists <jira-home>/logs/support (possibly will gather old data) will grab the file however changing name to avoid confusion echo ' - Packing healthcheck results, if any available' if(Test-Path -Path $JIRAHOME/logs/support/healthcheckResults.txt -PathType Leaf) { cp $JIRAHOME/logs/support/healthcheckResults.txt $EXPORT/healthchecks/last_healthcheckResults.txt } else{ echo ' -- Last healthcheck file does not exist. Leaving without it.' } #application-properties #If exists <jira-home>/logs/support (possibly will gather old data) will grab the file however changing name to avoid confusion echo ' - Packing the application.xml, if any available' if(Test-Path -Path $JIRAHOME/logs/support/application.xml -PathType Leaf) { echo " - Coppying last available application.xml" cp $JIRAHOME/logs/support/application.xml $EXPORT/application-properties/last-application.xml } else{ echo " - No application.xml found. Leaving without it." } #Pack and go echo "."; echo 'Creating zip file...' Compress-Archive -LiteralPath $EXPORT -DestinationPath $BEXPORT/Jira_support_$DATE.zip -Force cd $BEXPORT echo "." echo "." echo "." echo "."; echo "The support zip file can be found in $BEXPORT/Jira_support_$DATE.zip, please upload this file to Atlassian." echo "." echo "Have a g'day =)" echo "." #EOF

Usage

The basic script shall be run using powershell prompt as:

./supportzip.ps1 [-h <jira home path>] [-a <jira app path>]

With details:

1 2 3 Usage: .\supportzip.ps1 [-h <jira home path>] [-a <jira app path>] -h: obligatory, absolute path of jira home directory -a: obligatory, absolute path of jira application directory

Example

Below you may find an example of running the script with Windows and paths:

  • Node home folder (-h) "C:\Program Files\Atlassian\Application Data\Jira", and

  • Application folder (-a) "C:\Program Files\Atlassian\Jira"

The final command shall be (using Powershell):

.\supportzip.ps1 -a "C:\Program Files\Atlassian\Jira" -h "C:\Program Files\Atlassian\Application Data\Jira"

With details:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 PS C:\> .\supportzip.ps1 -a "C:\Program Files\Atlassian\Jira" -h "C:\Program Files\Atlassian\Application Data\Jira" __ ------------------------------------------ _(\ |@@| | Beep - Generating Atlassian Support Zip | (__/\__ \--/ __ /_------------------------------------------ \___|----| | __ \ }{ /\ )_ / _\ /\__/\ \__O (__ (--/\--) \__/ _)( )(_ # Atlassian support zip tool # ############################## 2023-08-14_01-24 Jira Home = C:\Program Files\Atlassian\Application Data\Jira Jira App = C:\Program Files\Atlassian\Jira Current user = ec2amaz-81f6lqb\administrator . Hit CTRL+C (10s wait) if any path or user is incorrect. - Creating basic structure .... .... - Packing application logs - Packing application config files - Packing configuration summary, if any available - Packing the last directoryConfigurationSummary available. - Packing all Tomcat logs - Packing cache configuration files - Packing tomcat configuration files - Packing healthcheck results, if any available - Packing the application.xml, if any available - Copying last available application.xml . Creating zip file... . . . . The support zip file can be found in C:\Program Files\Atlassian\Application Data\Jira/export/Jira_support_2023-08-14_01-24.zip, please upload this file to Atlassian. . Have a g'day =) .

For both Linux and Windows the support.zip generated file will be placed at <jira-home>/export.

Important notes

  • This solution is not a substitute of UI Support Zip. If you have the chance to generate the support zip though the UI, please prefer to use it.

  • This solution is not supported by Atlassian, and the performance of the UI may differ from the command line tool.

  • Username and passwords are sanitized in dbconfig.xml (database), directoryConfigurationSummary (directories) and server.xml/tomcat-users.xml (tomcat configuration).

Updated on April 14, 2025

Still need help?

The Atlassian Community is here for you.