How to create a Confluence 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 Confluence web interface, the UI, is not working properly, running and getting the support zip is a challenge, requiring Confluence or a System administrator to collect log and configuration files by logging on the server where a Confluence node is running to retrieve them manually. To facilitate it, this solution aims 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.
Recognize and have read permission on Confluence Home and Confluence Application folders (recommended root/Administrator or the Jira user if using Linux).
⚠️ Attention when using Confluence Data Center with multiple nodes, the script shall be run in each node separately. 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 script, how to use and expected output.
Linux
Script
connie-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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/bin/bash
######################
# supportzip_connie.sh
# 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
# 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 <Confluence home path>] [-a <Confluence app path>] -t
-h: obligatory, absolute path of Confluence home directory
-a: obligatory, absolute path of Confluence 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}
;;
s|S)
s=${OPTARG}
;;
t|T)
TD=1
;;
*)
usage
;;
esac
done
if [ -z $h ] || [ -z $a ]; then
usage
fi
###############THE PATHS
CONFAPP=$a
CONFHOME=$h
SHAREDHOME=$s
BEXPORT=$CONFHOME/export
LOG=$BEXPORT/Confluence_support_$DATE.log
EXPORT=$BEXPORT/Confluence_support_$DATE
echo '
__ ------------------------------------------
_(\ |@@| | Beep - Generating Atlassian Support Zip |
(__/\__ \--/ __ /_------------------------------------------
\___|----| | __
\ }{ /\ )_ / _\
/\__/\ \__O (__
(--/\--) \__/
_)( )(_
`---''---`
'
echo "
##############################
# Atlassian support zip tool #
##############################
User = $USER
Confluence Home = $CONFHOME
Confluence App Directory = $CONFAPP
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-config,application-logs,application-properties,auth-cfg,cache-cfg,confluence-customisations,healthchecks,thread-dump,synchrony-config,tomcat-config,tomcat-logs}
mkdir -p $EXPORT/confluence-customisations/layouts
#application-logs
echo ' - Packing application logs'
echo "`date +%Y-%m-%d-%H-%M-%S` - application-logs" >> $LOG
cp -f $CONFHOME/logs/* $EXPORT/application-logs/
# application-config
#Confluence configuration files
echo ' - Packing application config files'
echo "`date +%Y-%m-%d-%H-%M-%S` - application-config" >> $LOG
cat $CONFHOME/confluence.cfg.xml | sed 's/password\"\>.*/password\"\>Sanitized by Support Utility\<\/property\>/g' | sed 's/username\"\>.*/username\"\>Sanitized by Support Utility\<\/property\>/g' > $EXPORT/application-config/confluence.cfg.xml
#OLD cat -> cat $CONFHOME/confluence.cfg.xml | sed 's/password\"\>.*/password\"\>Sanitized by Support Utility/g' | sed 's/username\>.*/username\"\>Sanitized by Support Utility/g' > $EXPORT/application-config/confluence.cfg.xml
##<property name="hibernate.connection.password">Sanitized by Support Utility</property>
##<property name="hibernate.connection.username">Sanitized by Support Utility</property>
cp -f $CONFAPP/confluence/WEB-INF/classes/{confluence-init.properties,log4j-diagnostic.properties,log4j.properties} $EXPORT/application-config/
cp -f $CONFAPP/confluence/WEB-INF/classes/logging.properties $EXPORT/application-config/logging.properties
cp -f $CONFAPP/confluence/WEB-INF/web.xml $EXPORT/application-config/web.xml
cp -f $CONFAPP/bin/{setclasspath.sh,setclasspath.bat,setenv.sh,setenv.bat,shutdown.sh,shutdown.bat,start-confluence.sh,start-confluence.bat,startup.sh,startup.bat,stop-confluence.sh,stop-confluence.bat} $EXPORT/application-config/
for i in setclasspath.sh setclasspath.bat setenv.sh setenv.bat shutdown.sh shutdown.bat start-confluence.sh start-confluence.bat startup.sh startup.bat stop-confluence.sh stop-confluence.bat ; do tmp=`echo $i | sed 's/\./-/g'`; mv $EXPORT/application-config/$i $EXPORT/application-config/$tmp.txt; done
#auth-cfg
#If exists <confluence-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 $CONFHOME/logs/support/directoryConfigurationSummary.txt ]; then
echo ' - Packing the last directoryConfigurationSummary available.'
cat $CONFHOME/logs/support/directoryConfigurationSummary.txt | sed 's/password:.*/password: Sanitized by Support Utility/g' > $EXPORT/auth-cfg/`ls -l $CONFHOME/logs/support/directoryConfigurationSummary.txt | awk -F' ' '{print $6"-"$7}'`.directoryConfigurationSummary.txt;
fi
echo ' - Packing seraph and crowd configuration files'
echo "`date +%Y-%m-%d-%H-%M-%S` - auth-cfg" >> $LOG
cp -f $CONFAPP/confluence/WEB-INF/classes/{crowd.properties,seraph-config.xml,seraph-paths.xml} $EXPORT/auth-cfg/
#confluence-customisations
echo ' - Packing confluence customisations files'
echo "`date +%Y-%m-%d-%H-%M-%S` - confluence-customisations" >> $LOG
cp -f $CONFHOME/logs/support/{customHtml.txt,customStylesheet.txt}} $EXPORT/confluence-customisations
echo ' - Packing custom layouts files'
echo "`date +%Y-%m-%d-%H-%M-%S` - confluence-customisations/layouts" >> $LOG
cp -f $CONFHOME/logs/support/customLayouts.txt $EXPORT/confluence-customisations/layouts
cp -f $CONFHOME/logs/support/*.vmd $EXPORT/confluence-customisations/layouts
#synchrony-config
echo ' - Packing synchrony configuration file'
echo "`date +%Y-%m-%d-%H-%M-%S` - synchrony-config" >> $LOG
cp -f $CONFHOME/synchrony-args.properties $EXPORT/synchrony-config
################################################
######## Double check this one for shared home folder on DC
################################################
#cache-cfg
echo ' - Packing cache configuration files'
echo "`date +%Y-%m-%d-%H-%M-%S` - cache-cfg" >> $LOG
cp -f $SHAREDHOME/cache-settings-overrides.properties $EXPORT/cache-cfg
#tomcat-config
echo ' - Packing tomcat configuration files'
echo "`date +%Y-%m-%d-%H-%M-%S` - tomcat-config" >> $LOG
cp -f $CONFAPP/conf/{catalina.policy,catalina.properties,context.xml,jaspic-providers.xml,logging.properties,server.xml,tomcat-users.xml,web.xml} $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 <confluence-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 $CONFHOME/logs/support/healthcheckResults.txt ]; then
## cp -f $CONFHOME/logs/support/healthcheckResults.txt $EXPORT/healthchecks/`ls -l $CONFHOME/logs/support/healthcheckResults.txt | awk -F' ' '{print $6"-"$7}'`.healthcheckResults.txt;
cp -f $CONFHOME/logs/support/healthcheckResults.txt $EXPORT/healthchecks
fi
#tomcat-logs
echo ' - Packing Tomcat logs'
echo "`date +%Y-%m-%d-%H-%M-%S` - tomcat-logs" >> $LOG
#find $CONFAPP/logs -type f \( ! -iname "access_log*" \) -mtime -10 -exec cp -a "{}" $EXPORT/tomcat-logs \;
cp -f $CONFAPP/logs/* $EXPORT/tomcat-logs
#application-properties
#If exists <confluence-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 $CONFHOME/logs/support/application.xml ]; then
## cp -f $CONFHOME/logs/support/application.xml $EXPORT/application-properties/`ls -l $CONFHOME/logs/support/application.xml | awk -F' ' '{print $6"-"$7}'`.application.xml;
cp -f $CONFHOME/logs/support/application.xml $EXPORT/application-properties
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 confluence | grep -i java | grep -v synchrony.core | 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
#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 ../Confluence_support_$DATE.zip ./* 2>&1 >> $LOG;
echo; echo "The support zip file can be found in $BEXPORT/Confluence_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 Confluence_support_$DATE.tar $EXPORT/*; gzip Confluence_support_$DATE.tar 2>&1 >> $LOG;
echo; echo "The support zip file can be found in $BEXPORT/Confluence_support_$DATE.tar.gz, please upload this file to Atlassian."
echo "."
echo "Have a g'day =)"
echo
fi
#EOF
Usage
1
2
3
4
5
# ./connie-supportzip.sh -h
Usage: ./supportzip_connie.sh [-h <Confluence home path>] [-a <Confluence app path>] -t
-h: obligatory, absolute path of Confluence home directory
-a: obligatory, absolute path of Confluence application directory
-t: optional, to run and collect thread dumps
The support.zip file will be placed at <confluence-home>/export.
Output
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
./supportzip_connie.sh -h /Atlassian/confluence/installation/8_8_x/8_8_0_conf_home -a /Atlassian/confluence/installation/8_8_x/atlassian-confluence-8.8.0
__ ------------------------------------------
_(\ |@@| | Beep - Generating Atlassian Support Zip |
(__/\__ \--/ __ /_------------------------------------------
\___|----| | __
\ }{ /\ )_ / _\
/\__/\ \__O (__
(--/\--) \__/
_)( )(_
`------`
##############################
# Atlassian support zip tool #
##############################
User = dalves
Confluence Home = /Users/dalves/Documents/Study/Atlassian/confluence/installation/8_8_x/8_8_0_conf_home
Confluence App Directory = /Users/dalves/Documents/Study/Atlassian/confluence/installation/8_8_x/atlassian-confluence-8.8.0
Hit CTRL+C (10s wait) if any path or user is incorrect.
./supportzip_connie.sh: line 81: /Users/dalves/Documents/Study/Atlassian/confluence/installation/8_8_x/8_8_0_conf_home/export/Confluence_support_2025-01-22-18-25-41.log: No such file or directory
- Packing application logs
- Packing application config files
- Packing configuration summary, if any available
- Packing seraph and crowd configuration files
- Packing confluence customisations files
- Packing custom layouts files
- Packing synchrony configuration file
- Packing cache configuration files
- Packing tomcat configuration files
- Packing healthcheckResults, if any available
- Packing Tomcat logs
- Packing the application.xml, if any available
- Thread dump will not be collected
Creating zip file...
The support zip file can be found in /Users/dalves/Documents/Study/Atlassian/confluence/installation/8_8_x/8_8_0_conf_home/export/Confluence_support_2025-01-22-18-25-41.zip, please upload this file to Atlassian.
.
Have a g'day =)
Zip file structure (example from test environment, yours may be different):
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
Confluence_support_2022-05-19-14-07-25
├── application-config
│ ├── confluence-init.properties
│ ├── confluence.cfg.xml
│ ├── log4j-diagnostic.properties
│ ├── log4j.properties
│ ├── logging.properties
│ ├── setclasspath-bat.txt
│ ├── setclasspath-sh.txt
│ ├── setenv-bat.txt
│ ├── setenv-sh.txt
│ ├── shutdown-bat.txt
│ ├── shutdown-sh.txt
│ ├── start-confluence-bat.txt
│ ├── start-confluence-sh.txt
│ ├── startup-bat.txt
│ ├── startup-sh.txt
│ ├── stop-confluence-bat.txt
│ ├── stop-confluence-sh.txt
│ └── web.xml
├── application-logs
│ ├── atlassian-confluence-index.log
│ ├── atlassian-confluence-index.log.1
│ ├── atlassian-confluence-jmx.log
│ ├── atlassian-confluence-outgoing-mail.log
│ ├── atlassian-confluence-profiler.log
│ ├── atlassian-confluence-security.log
│ ├── atlassian-confluence-sql.log
│ ├── atlassian-confluence.log
│ ├── atlassian-confluence.log.1
│ ├── atlassian-confluence.log.2
│ ├── atlassian-confluence.log.3
│ ├── atlassian-confluence.log.4
│ ├── atlassian-confluence.log.5
│ ├── atlassian-diagnostics.log
│ ├── atlassian-synchrony.log
│ └── atlassian-synchrony.log.1
├── application-properties
│ └── application.xml
├── auth-cfg
│ ├── May-16.directoryConfigurationSummary.txt
│ ├── crowd.properties
│ ├── seraph-config.xml
│ └── seraph-paths.xml
├── cache-cfg
├── confluence-customisations
│ └── layouts
│ ├── Space FirsSpace customised layout - decorators-main.vmd
│ ├── Space FirsSpace customised layout - decorators-page.vmd
│ ├── Space FirsSpace customised layout - decorators-space.vmd
│ └── customLayouts.txt
├── healthchecks
│ └── healthcheckResults.txt
├── synchrony-config
│ └── synchrony-args.properties
├── thread-dump
├── tomcat-config
│ ├── catalina.policy
│ ├── catalina.properties
│ ├── context.xml
│ ├── jaspic-providers.xml
│ ├── logging.properties
│ ├── server.xml
│ ├── tomcat-users.xml
│ └── web.xml
└── tomcat-logs
├── atlassian-synchrony-proxy.log
├── catalina.2022-04-01.log
├── catalina.2022-04-04.log
├── catalina.2022-04-05.log
├── catalina.2022-04-06.log
├── catalina.2022-04-07.log
├── catalina.2022-04-09.log
├── catalina.2022-04-11.log
├── catalina.2022-04-17.log
├── catalina.2022-04-18.log
├── catalina.2022-04-25.log
├── catalina.2022-04-29.log
├── catalina.2022-05-02.log
├── catalina.2022-05-04.log
├── catalina.2022-05-05.log
├── catalina.2022-05-06.log
├── catalina.2022-05-07.log
├── catalina.2022-05-11.log
├── catalina.2022-05-16.log
├── catalina.2022-05-18.log
├── catalina.out
├── conf_access_log.2022-04-19.log
├── conf_access_log.2022-04-20.log
├── conf_access_log.2022-04-21.log
├── conf_access_log.2022-04-22.log
├── conf_access_log.2022-04-23.log
├── conf_access_log.2022-04-24.log
├── conf_access_log.2022-04-25.log
├── conf_access_log.2022-04-29.log
├── conf_access_log.2022-05-02.log
├── conf_access_log.2022-05-03.log
├── conf_access_log.2022-05-04.log
├── conf_access_log.2022-05-05.log
├── conf_access_log.2022-05-06.log
├── conf_access_log.2022-05-07.log
├── conf_access_log.2022-05-08.log
├── conf_access_log.2022-05-09.log
├── conf_access_log.2022-05-10.log
├── conf_access_log.2022-05-11.log
├── conf_access_log.2022-05-12.log
├── conf_access_log.2022-05-13.log
├── conf_access_log.2022-05-14.log
├── conf_access_log.2022-05-15.log
├── conf_access_log.2022-05-16.log
├── conf_access_log.2022-05-17.log
├── conf_access_log.2022-05-18.log
├── conf_access_log.2022-05-19.log
├── gc-2022-04-01_14-54-55.log.0.current
├── gc-2022-04-01_15-00-44.log.0.current
├── gc-2022-04-01_15-28-07.log.0.current
├── gc-2022-04-01_15-41-19.log.0.current
├── gc-2022-04-01_15-46-34.log.0.current
├── gc-2022-04-01_16-06-19.log.0.current
├── gc-2022-04-01_16-12-43.log.0.current
├── gc-2022-04-04_16-25-35.log.0.current
├── gc-2022-04-04_16-32-47.log.0.current
├── gc-2022-04-04_16-47-57.log.0.current
├── gc-2022-04-09_22-25-36.log.0.current
├── gc-2022-04-17_12-27-43.log.0.current
├── gc-2022-04-25_15-09-12.log.0.current
├── gc-2022-04-25_15-34-24.log.0.current
├── gc-2022-04-25_15-44-24.log.0.current
├── gc-2022-04-25_17-34-47.log.0.current
├── gc-2022-04-29_14-19-27.log.0.current
├── gc-2022-04-29_14-53-42.log.0.current
├── gc-2022-05-02_13-49-00.log.0.current
├── gc-2022-05-02_14-06-16.log.0.current
├── gc-2022-05-16_12-05-26.log.0.current
├── host-manager.2022-04-01.log
├── host-manager.2022-04-04.log
├── host-manager.2022-04-09.log
├── host-manager.2022-04-17.log
├── host-manager.2022-04-25.log
├── host-manager.2022-04-29.log
├── host-manager.2022-05-02.log
├── host-manager.2022-05-16.log
├── localhost.2022-04-01.log
├── localhost.2022-04-04.log
├── localhost.2022-04-09.log
├── localhost.2022-04-17.log
├── localhost.2022-04-25.log
├── localhost.2022-04-29.log
├── localhost.2022-05-02.log
├── localhost.2022-05-16.log
├── manager.2022-04-01.log
├── manager.2022-04-04.log
├── manager.2022-04-09.log
├── manager.2022-04-17.log
├── manager.2022-04-25.log
├── manager.2022-04-29.log
├── manager.2022-05-02.log
├── manager.2022-05-16.log
└── synchrony-proxy-watchdog.log
Windows
Script
connie-supportzip.ps1
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
######################
# supportzip.ps1
# 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 202412 - 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
)
# THE PATHS AND BASIC
$CONFHOME=$h
$CONFAPP=$a
$DATE=(get-date -f yyyy-MM-dd_hh-mm)
$SHAREDHOME=
#SHAREDHOME=`if [ -f $CONFHOME/confluence.cfg.xml ]; then grep confluence.cluster.home $CONFHOME/confluence.cfg.xml | cut -d'>' -f2 | cut -d'<' -f1 | awk '{print $1}'; fi
$IAM = whoami
$BEXPORT="$CONFHOME/export"
$LOG="$BEXPORT/Confluence_support.log"
$EXPORT="$BEXPORT/Confluence_support_zip_$DATE"
if ( !(Test-Path -Path $h) -or !(Test-Path -Path $a))
{
echo "Usage: .\connie-supportzip.ps1 [-h <confluence home path>] [-a <confluence app path>]
-h: obligatory, absolute path of confluence home directory
-a: obligatory, absolute path of confluence application directory"
exit 1
}
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 "Confluence Home = $CONFHOME"
echo "Confluence App = $CONFAPP"
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,confluence-customisations,synchrony-config,jfr-bundle,tomcat-access-logs > $null
cd $EXPORT/confluence-customisations
mkdir layouts
cd $EXPORT
echo " .... "
#application-logs
echo " - Packing application logs"
cp $CONFHOME/log/* $EXPORT/application-logs/
# application-config
echo ' - Packing application config files'
# application-config
#confluence configuration files
echo ' - Packing application config files'
## For later, sanitizization >> sed 's/password\"\>.*/password\"\>Sanitized by Support Utility\<\/property\>/g' | sed 's/username\"\>.*/username\"\>Sanitized by Support Utility\<\/property\>/g' > $EXPORT/application-config/confluence.cfg.xml
## For later, sanitizization >> (Get-Content $CONFHOME/confluence.cfg.xml) -replace '<username>.+','<username>Sanitized by Support Utility</username>' -replace '<password>.+','<password>Sanitized by Support Utility</password>'
cp $CONFHOME/confluence.cfg.xml $EXPORT/application-config/confluence.cfg.xml
cp $CONFAPP/confluence/WEB-INF/classes/confluence-init.properties $EXPORT/application-config/confluence-init.properties
cp $CONFAPP/confluence/WEB-INF/classes/log4j-diagnostic.properties $EXPORT/application-config/log4j-diagnostic.properties
cp $CONFAPP/confluence/WEB-INF/classes/log4j.properties $EXPORT/application-config/log4j.properties
cp $CONFAPP/confluence/WEB-INF/classes/logging.properties $EXPORT/application-config/logging.properties
cp $CONFAPP/confluence/WEB-INF/web.xml $EXPORT/application-config/web.xml
cp $CONFAPP/bin/setclasspath.sh $EXPORT/application-config/setclasspath-sh.txt
cp $CONFAPP/bin/setclasspath.bat $EXPORT/application-config/setclasspath-bat.txt
cp $CONFAPP/bin/setenv.sh $EXPORT/application-config/setenv-sh.txt
cp $CONFAPP/bin/setenv.bat $EXPORT/application-config/setenv-bat.txt
cp $CONFAPP/bin/shutdown.sh $EXPORT/application-config/shutdown-sh.txt
cp $CONFAPP/bin/shutdown.bat $EXPORT/application-config/shutdown-bat.txt
cp $CONFAPP/bin/start-confluence.sh $EXPORT/application-config/start-confluence-sh.txt
cp $CONFAPP/bin/start-confluence.bat $EXPORT/application-config/start-confluence-bat.txt
cp $CONFAPP/bin/startup.sh $EXPORT/application-config/startup-sh.txt
cp $CONFAPP/bin/startup.bat $EXPORT/application-config/startup-bat.txt
cp $CONFAPP/bin/stop-confluence.sh $EXPORT/application-config/stop-confluence-sh.txt
cp $CONFAPP/bin/stop-confluence.bat $EXPORT/application-config/stop-confluence-bat.txt
#auth-cfg
#If exists <confluence-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 $CONFHOME/logs/support/directoryConfigurationSummary.txt -PathType Leaf) {
echo ' - Packing the last directoryConfigurationSummary available.'
cp $CONFHOME/logs/support/directoryConfigurationSummary.txt $EXPORT/auth-cfg/
}
else {
echo ' -- Last directoryConfigurationSummary does not exist. Leaving.'
}
cp $CONFAPP/confluence/WEB-INF/classes/seraph-config.xml $EXPORT/auth-cfg/
cp $CONFAPP/confluence/WEB-INF/classes/seraph-paths.xml $EXPORT/auth-cfg/
cp $CONFAPP/confluence/WEB-INF/classes/crowd.properties $EXPORT/auth-cfg/
#confluence-customisations
echo ' - Packing confluence customisations files'
cp $CONFHOME/logs/support/customHtml.txt $EXPORT/confluence-customisations/
cp $CONFHOME/logs/support/customStylesheet.txt $EXPORT/confluence-customisations/
echo ' - Packing custom layouts files'
cp $CONFHOME/logs/support/customLayouts.txt $EXPORT/confluence-customisations/layouts/
cp $CONFHOME/logs/support/*.vmd $EXPORT/confluence-customisations/layouts/
#synchrony-config
echo ' - Packing synchrony configuration file'
cp $CONFHOME/synchrony-args.properties $EXPORT/synchrony-config/
################################################
######## Double check this one for shared home folder on DC
################################################
#cache-cfg
#echo ' - Packing cache configuration files'
#cp $SHAREDHOME/cache-settings-overrides.properties $EXPORT/cache-cfg/
#tomcat-config
echo ' - Packing tomcat configuration files'
cp $CONFAPP/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 <confluence-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 $CONFHOME/logs/support/healthcheckResults.txt -PathType Leaf) {
cp $CONFHOME/logs/support/healthcheckResults.txt $EXPORT/healthchecks/last_healthcheckResults.txt
}
else{
echo ' -- Last healthcheck file does not exist. Leaving without it.'
}
#Get tomcat logs
echo ' - Packing all Tomcat logs'
cp $CONFAPP/logs/* $EXPORT/tomcat-logs/
#Get access logs
echo ' - Packing access logs'
cp "$CONFAPP/logs/*access_log*" $EXPORT/tomcat-access-logs/
#application-properties
#If exists <confluence-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 $CONFHOME/logs/support/application.xml -PathType Leaf) {
echo " - Coppying last available application.xml"
cp $CONFHOME/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/confluence_support_$DATE.zip -Force
cd $BEXPORT
echo "."
echo "."
echo "."
echo "."; echo "The support zip file can be found in $BEXPORT/confluence_support_$DATE.zip, please upload this file to Atlassian."
echo "."
echo "Have a g'day =)"
echo "."
#EOF
Usage
The basic script shall be run as follows:
./connie-supportzip.ps1 [-h <confluence home path>] [-a <confluence app path>]
With details:
1
2
3
Usage: .\connie-supportzip.ps1 [-h <confluence home path>] [-a <confluence app path>]
-h: obligatory, absolute path of confluence home directory
-a: obligatory, absolute path of confluence 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\Confluence", and
Application folder (-a) "C:\Program Files\Atlassian\Confluence"
The final command shall be (using Powershell):
.\connie_support_zip.ps1 -h "C:\Program Files\Atlassian\Application Data\Confluence" -a "C:\Program Files\Atlassian\Confluence"
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
42
43
C:\> .\connie_support_zip.ps1 -h "C:\Program Files\Atlassian\Application Data\Confluence" -a "C:\Program Files\Atlassian\Confluence"
__ ------------------------------------------
_(\ |@@| | Beep - Generating Atlassian Support Zip |
(__/\__ \--/ __ /_------------------------------------------
\___|----| | __
\ }{ /\ )_ / _\
/\__/\ \__O (__
(--/\--) \__/
_)( )(_
# Atlassian support zip tool #
##############################
2024-12-18_09-06
Confluence Home = C:\Program Files\Atlassian\Application Data\Confluence
Confluence App = C:\Program Files\Atlassian\Confluence
Current user = ec2amaz-55f3hb0\administrator
.
Hit CTRL+C (10s wait) if any path or user is incorrect.
- Creating basic structure
- Packing application logs
- Packing application config files
- Packing application config files
- Packing configuration summary, if any available
- Packing the last directoryConfigurationSummary available.
- Packing confluence customisations files
- Packing custom layouts files
- Packing synchrony configuration file
- Packing tomcat configuration files
- Packing healthcheck results, if any available
- Packing all Tomcat logs
- Packing access logs
- Packing the application.xml, if any available
- Coppying last available application.xml
.
Creating zip file...
.
.
.
.
The support zip file can be found in C:\Program Files\Atlassian\Application Data\Confluence/export/confluence_support_2024-12-18_09-06.zip, please upload this file to Atlassian.
.
Have a g'day =)
.
For both Linux and Windows the support.zip generated <confluence-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 confluence.cfg.xml, directoryConfigurationSummary (directories) and server.xml/tomcat-users.xml (tomcat configuration) when using Linux, for Windows it is still in progress. For this platform, you can sanitize them before sending to Atlassian.
Was this helpful?