github.com/vnpaycloud-console/gophercloud/v2@v2.0.5/script/collectlogs (about)

     1  #!/bin/bash
     2  #
     3  # Collect logs after an integration test failure.
     4  
     5  # We intentionally don't set '-e' (exit on first failure) since we don't want
     6  # to fail on these diagnostic steps
     7  set -uxo pipefail
     8  
     9  LOG_DIR=${LOG_DIR:-/tmp/devstack-logs}
    10  mkdir -p "$LOG_DIR"
    11  # shellcheck disable=SC2024
    12  sudo journalctl -o short-precise --no-pager &> "$LOG_DIR/journal.log"
    13  # shellcheck disable=SC2024
    14  sudo systemctl status "devstack@*" &> "$LOG_DIR/devstack-services.txt"
    15  for service in $(systemctl list-units --output json devstack@* | jq -r '.[].unit | capture("devstack@(?<svc>[a-z\\-]+).service") | '.svc'')
    16  do
    17      journalctl -u "devstack@${service}.service" --no-tail > "${LOG_DIR}/${service}.log"
    18  done
    19  free -m > "$LOG_DIR/free.txt"
    20  dpkg -l > "$LOG_DIR/dpkg-l.txt"
    21  pip freeze > "$LOG_DIR/pip-freeze.txt"
    22  cp ./devstack/local.conf "$LOG_DIR"
    23  sudo find "$LOG_DIR" -type d -exec chmod 0755 {} \;
    24  sudo find "$LOG_DIR" -type f -exec chmod 0644 {} \;