github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/contrib/cirrus/logcollector.sh (about) 1 #!/bin/bash 2 3 set -e 4 5 source $(dirname $0)/lib.sh 6 7 req_env_var CIRRUS_WORKING_DIR OS_RELEASE_ID TEST_REMOTE_CLIENT 8 9 # Assume there are other log collection commands to follow - Don't 10 # let one break another that may be useful, but also keep any 11 # actual script-problems fatal so they are noticed right away. 12 showrun() { 13 echo '+ '$(printf " %q" "$@") 14 set +e 15 echo '------------------------------------------------------------' 16 "$@" 17 local status=$? 18 [[ $status -eq 0 ]] || \ 19 echo "[ rc = $status -- proceeding anyway ]" 20 echo '------------------------------------------------------------' 21 set -e 22 } 23 24 case $1 in 25 audit) 26 case $OS_RELEASE_ID in 27 ubuntu) showrun cat /var/log/kern.log ;; 28 fedora) showrun cat /var/log/audit/audit.log ;; 29 *) bad_os_id_ver ;; 30 esac 31 ;; 32 df) showrun df -lhTx tmpfs ;; 33 ginkgo) showrun cat $CIRRUS_WORKING_DIR/test/e2e/ginkgo-node-*.log ;; 34 journal) showrun journalctl -b ;; 35 podman) showrun ./bin/podman system info ;; 36 varlink) 37 if [[ "$TEST_REMOTE_CLIENT" == "true" ]] 38 then 39 echo "(Trailing 100 lines of $VARLINK_LOG)" 40 showrun tail -100 $VARLINK_LOG 41 else 42 die 0 "\$TEST_REMOTE_CLIENT is not 'true': $TEST_REMOTE_CLIENT" 43 fi 44 ;; 45 packages) 46 # These names are common to Fedora and Ubuntu 47 PKG_NAMES=(\ 48 conmon \ 49 containernetworking-plugins \ 50 containers-common \ 51 criu \ 52 golang \ 53 podman \ 54 skopeo \ 55 slirp4netns \ 56 ) 57 case $OS_RELEASE_ID in 58 fedora*) 59 cat /etc/fedora-release 60 PKG_LST_CMD='rpm -q --qf=%{N}-%{V}-%{R}-%{ARCH}\n' 61 PKG_NAMES+=(\ 62 container-selinux \ 63 crun \ 64 libseccomp \ 65 runc \ 66 ) 67 ;; 68 ubuntu*) 69 cat /etc/issue 70 PKG_LST_CMD='dpkg-query --show --showformat=${Package}-${Version}-${Architecture}\n' 71 PKG_NAMES+=(\ 72 cri-o-runc \ 73 libseccomp2 \ 74 ) 75 ;; 76 *) bad_os_id_ver ;; 77 esac 78 echo "Kernel: " $(uname -r) 79 echo "Cgroups: " $(stat -f -c %T /sys/fs/cgroup) 80 # Any not-present packages will be listed as such 81 $PKG_LST_CMD ${PKG_NAMES[@]} | sort -u 82 ;; 83 *) die 1 "Warning, $(basename $0) doesn't know how to handle the parameter '$1'" 84 esac