Skip to content

Commit a7ecc2e

Browse files
authored
Merge pull request gophercloud#3054 from stephenfin/capture-logs
CI: Capture service logs
2 parents 6eb9275 + 269836b commit a7ecc2e

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

script/collectlogs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
set -x
33

44
LOG_DIR=${LOG_DIR:-/tmp/devstack-logs}
5-
mkdir -p $LOG_DIR
6-
sudo journalctl -o short-precise --no-pager &> $LOG_DIR/journal.log
7-
sudo systemctl status "devstack@*" &> $LOG_DIR/devstack-services.txt
8-
free -m > $LOG_DIR/free.txt
9-
dpkg -l > $LOG_DIR/dpkg-l.txt
10-
pip freeze > $LOG_DIR/pip-freeze.txt
11-
cp ./devstack/local.conf $LOG_DIR
12-
sudo find $LOG_DIR -type d -exec chmod 0755 {} \;
13-
sudo find $LOG_DIR -type f -exec chmod 0644 {} \;
5+
mkdir -p "$LOG_DIR"
6+
# shellcheck disable=SC2024
7+
sudo journalctl -o short-precise --no-pager &> "$LOG_DIR/journal.log"
8+
# shellcheck disable=SC2024
9+
sudo systemctl status "devstack@*" &> "$LOG_DIR/devstack-services.txt"
10+
for service in $(systemctl list-units --output json devstack@* | jq -r '.[].unit | capture("devstack@(?<svc>[a-z\\-]+).service") | '.svc'')
11+
do
12+
journalctl -u "devstack@${service}.service" --no-tail > "${LOG_DIR}/${service}.log"
13+
done
14+
free -m > "$LOG_DIR/free.txt"
15+
dpkg -l > "$LOG_DIR/dpkg-l.txt"
16+
pip freeze > "$LOG_DIR/pip-freeze.txt"
17+
cp ./devstack/local.conf "$LOG_DIR"
18+
sudo find "$LOG_DIR" -type d -exec chmod 0755 {} \;
19+
sudo find "$LOG_DIR" -type f -exec chmod 0644 {} \;

0 commit comments

Comments
 (0)