How to create Crowd 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 the Crowd web interface, the UI, is not working properly, running and getting the Support Zip is a challenge, requiring Crowd 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, among other benefits.
Environment and requirements
The solution runs in Linux based Operating System with:
/bin/bash
zip and/or gzip applications
It's also required by the system administrator:
Being familiar with the Operating System command line interface.
Recognize the Crowd Home and Crowd Application folders.
Have read permission on Crowd Home and Crowd Application folders (recommended root/Administrator or the Crowd user if using Linux).
⚠️ Attention when using Crowd with multiple nodes, the script shall be run in each node separately and the home folder refers to the Crowd 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!
Solution
Below you may find the scripts, usage, and real examples for Linux
Script
crowd-supportzip.sh
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
#!/bin/bash
######################
# supportzip.sh
# Author: Douglas Alves - dalves@atlassian.com in behalf of Atlassian Customer Success team
# Atlassian base doc:
# https://confluence.atlassian.com/x/BZgBQw
# Versioning:
# 0.1 20220324 - Initial version
# 0.2 20220328 - Password sanitization
# 1.0 20220419 - Added thread dump // Confluence offline support zip
# 1.1 20240912 - Changed the path for the jfr
# 1.2 20241209 - Added crowd script
# To-do:
# Consult perf data (DB latency, OS, etc)
######################
USER=`whoami`
WHEREAMI=`pwd`
DATE=`date +%Y-%m-%d-%H-%M-%S`
TD=0
Tool="Crowd"
########THE OPTIONS#####
usage() { echo "Usage: $0 [-h <$Tool home path>] [-a <$Tool app path>] -t
-h: obligatory, absolute path of $Tool home directory
-a: obligatory, absolute path of $Tool 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
CROWDAPP=$a
CROWDHOME=$h
BEXPORT=$CROWDHOME/export
LOG=$BEXPORT/crowd_support_$DATE.log
EXPORT=$BEXPORT/crowd_support_$DATE
echo '
__ ------------------------------------------
_(\ |@@| | Beep - Generating Atlassian Support Zip |
(__/\__ \--/ __ /_------------------------------------------
\___|----| | __
\ }{ /\ )_ / _\
/\__/\ \__O (__
(--/\--) \__/
_)( )(_
`---''---`
'
echo "
##############################
# Atlassian support zip tool #
##############################
User = $USER
Crowd Home = $CROWDHOME
Crowd App = $CROWDAPP
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,tomcat-config,application-config,thread-dump,tomcat-logs,application-logs,tomcat-access-logs}
#application-logs
echo ' - Packing application logs'
echo "`date +%Y-%m-%d-%H-%M-%S` - application-logs" >> $LOG
cp -rf $CROWDHOME/logs/*crowd* $EXPORT/application-logs/
# application-config
#CROWD configuration files
echo ' - Packing application config files'
echo "`date +%Y-%m-%d-%H-%M-%S` - application-config" >> $LOG
cp -rf $CROWDHOME/shared/crowd.cfg.xml $EXPORT/application-config/
cp -rf $CROWDAPP/crowd-webapp/WEB-INF/classes/log4j2.properties $EXPORT/application-config/
cp -rf $CROWDAPP/apache-tomcat/bin/setclasspath.bat $EXPORT/application-config/setclasspath-bat.txt
cp -rf $CROWDAPP/apache-tomcat/bin/setclasspath.sh $EXPORT/application-config/setclasspath-sh.txt
cp -rf $CROWDAPP/apache-tomcat/bin/setenv.bat $EXPORT/application-config/setenv-bat.txt
cp -rf $CROWDAPP/apache-tomcat/bin/setenv.sh $EXPORT/application-config/setenv-sh.txt
cp -rf $CROWDAPP/apache-tomcat/bin/shutdown.bat $EXPORT/application-config/shutdown-bat.txt
cp -rf $CROWDAPP/apache-tomcat/bin/shutdown.sh $EXPORT/application-config/shutdown-sh.txt
cp -rf $CROWDAPP/apache-tomcat/bin/startup.bat $EXPORT/application-config/startup-bat.txt
cp -rf $CROWDAPP/apache-tomcat/bin/startup.sh $EXPORT/application-config/startup-sh.txt
#application-properties
#If exists <crowd-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 $CROWDHOME/logs/support/application.xml ]; then
cp -f $CROWDHOME/logs/support/application.xml $EXPORT/application-properties/`ls -l $CROWDHOME/logs/support/application.xml | awk -F' ' '{print $6"-"$7}'`.application.xml;
fi
#tomcat-config
echo ' - Packing tomcat configuration files'
echo "`date +%Y-%m-%d-%H-%M-%S` - tomcat-config" >> $LOG
cp -f $CROWDAPP/apache-tomcat/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
#tomcat-logs
echo ' - Packing Tomcat logs'
echo "`date +%Y-%m-%d-%H-%M-%S` - tomcat-logs" >> $LOG
find $CROWDAPP/apache-tomcat/logs -type f \( ! -iname "*access_log*" \) -mtime -10 -exec cp -a "{}" $EXPORT/tomcat-logs \;
#tomcat-access-logs
#Get last 5 days logs
echo ' - Packing Tomcat access logs, if enabled'
echo "`date +%Y-%m-%d-%H-%M-%S` - tomcat-access-logs" >> $LOG
find $CROWDAPP/apache-tomcat/logs/*access_log* -type f -mtime -10 -exec cp -a "{}" $EXPORT/tomcat-access-logs \; >/dev/null
#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 crowd | 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 ../Crowd_support_$DATE.zip ./* 2>&1 >> $LOG;
echo; echo "The support zip file can be found in $BEXPORT/Crowd_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 Crowd_support_$DATE.tar $EXPORT/*; gzip Crowd_support_$DATE.tar 2>&1 >> $LOG;
echo; echo "The support zip file can be found in $BEXPORT/Crowd_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:
./crowd-supportzip.sh [-h <crowd home path>] [-a <crowd app path>]
With details:
1
2
3
4
5
# ./crowd-supportzip.sh -h
Usage: ./supportzip.sh [-h <crowd home path>] [-a <crowd app path>] -t
-h: obligatory, absolute path of Crowd home directory
-a: obligatory, absolute path of Crowd 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/crowd/crowd-home", and
Application folder (-a) "/opt/atlassian/crowd/atlassian-crowd-5.3.6"
The script call shall be set as (the "-t" is optional to generate thread dumps):
./crowd-supportzip.sh -h /opt/atlassian/crowd/crowd-home -a /opt/atlassian/crowd/atlassian-crowd-5.3.6 -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
# ./crowd-supportzip.sh -h /opt/atlassian/crowd/crowd-home -a /opt/atlassian/crowd/atlassian-crowd-5.3.6 -t
__ ------------------------------------------
_(\ |@@| | Beep - Generating Atlassian Support Zip |
(__/\__ \--/ __ /_------------------------------------------
\___|----| | __
\ }{ /\ )_ / _\
/\__/\ \__O (__
(--/\--) \__/
_)( )(_
`------`
##############################
# Atlassian support zip tool #
##############################
User = dalves
Crowd Home = /Users/dalves/Documents/Study/Atlassian/crowd/installation/crowd_home_5_3_6
Crowd App = /Users/dalves/Documents/Study/Atlassian/crowd/installation/atlassian-crowd-5.3.6
Hit CTRL+C (10s wait) if any path or user is incorrect.
- Packing application logs
- Packing application config files
- Packing the application.xml, if any available
- Packing tomcat configuration files
cp: /Users/dalves/Documents/Study/Atlassian/crowd/installation/atlassian-crowd-5.3.6/apache-tomcat/conf/Catalina is a directory (not copied).
- Packing Tomcat logs
- Packing Tomcat access logs, if enabled
- Generating thread dumps - this will take ~1 minute
Creating zip file...
The support zip file can be found in /opt/atlassian/crowd/crowd-home/export/Crowd_support_2024-12-09-10-20-48.zip, please upload this file to Atlassian.
.
Have a g'day =)
The support.zip generated file will be placed at <crowd-home>/export.
Other 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 server.xml/tomcat-users.xml (tomcat configuration).
Was this helpful?