![Martin André](/assets/img/avatar_default.png)
This should serve as a base for retrieving useful information from the kolla build logs. For now, the script warns about obsolete package names and helps track packages that are installed too many times in different images. It only supports rpm-based distros for now. Change-Id: I160b6ede1336bd0c202621a48ca0218f72fc1270
92 lines
3.1 KiB
YAML
92 lines
3.1 KiB
YAML
---
|
|
- hosts: all
|
|
roles:
|
|
- collect-collectd
|
|
tasks:
|
|
- shell:
|
|
cmd: |
|
|
set +o errexit
|
|
mkdir -p logs
|
|
# copy system log
|
|
|
|
sudo cp -r /var/log logs/system_log
|
|
|
|
if which journalctl ; then
|
|
# the journal gives us syslog() and kernel output, so is like
|
|
# a concatenation of the above.
|
|
sudo journalctl --no-pager | sudo tee logs/syslog.txt > /dev/null
|
|
sudo journalctl --no-pager -u docker.service | sudo tee logs/docker.log > /dev/null
|
|
else
|
|
# assume rsyslog
|
|
sudo cp /var/log/syslog logs/syslog.txt
|
|
sudo cp /var/log/kern.log logs/kern_log.txt
|
|
sudo cp /var/log/upstart/docker.log logs/docker.log
|
|
fi
|
|
|
|
if sudo test -d /var/lib/docker/volumes/kolla_logs/_data; then
|
|
sudo cp -r /var/lib/docker/volumes/kolla_logs/_data logs/kolla_logs
|
|
fi
|
|
|
|
# sudo config
|
|
sudo cp -r /etc/sudoers.d logs/
|
|
sudo cp /etc/sudoers logs/sudoers.txt
|
|
|
|
df -h > logs/df.txt
|
|
free > logs/free.txt
|
|
sudo parted -l | sudo tee logs/parted-l.txt > /dev/null
|
|
mount > logs/mount.txt
|
|
env > logs/env.txt
|
|
|
|
if [ `command -v dpkg` ]; then
|
|
dpkg -l | sudo tee logs/dpkg-l.txt > /dev/null
|
|
fi
|
|
if [ `command -v rpm` ]; then
|
|
rpm -qa | sudo tee logs/rpm-qa.txt > /dev/null
|
|
fi
|
|
|
|
# final memory usage and process list
|
|
ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > logs/ps.txt
|
|
|
|
# docker related information
|
|
(docker info && docker system df && docker system df -v) > logs/docker-info.txt
|
|
|
|
sudo cp -r /etc/kolla logs/kolla_configs
|
|
|
|
# fix the permissions for logs folder
|
|
sudo chmod -R 777 logs
|
|
|
|
# Parse build logs and extract pkg install info
|
|
tests/files/process_build_logs.py -l logs/build -b {{ base_distro }} > logs/packages-info.txt
|
|
|
|
# rename files to .txt; this is so that when displayed via
|
|
# logs.openstack.org clicking results in the browser shows the
|
|
# files, rather than trying to send it to another app or make you
|
|
# download it, etc.
|
|
|
|
# firstly, rename all .log files to .txt files
|
|
for f in $(find logs -name "*.log"); do
|
|
sudo mv $f ${f/.log/.txt}
|
|
done
|
|
|
|
# Update symlinks to new file names
|
|
for f in $(find logs -name "*FAILED*"); do
|
|
sudo mv ${f} ${f}.gz
|
|
sudo ln -sf ${f#*/000_FAILED_}.gz ${f}.gz
|
|
done
|
|
|
|
# append .txt to all kolla config file
|
|
find logs/kolla_configs -type f -exec mv '{}' '{}'.txt \;
|
|
|
|
# Compress all text logs
|
|
find logs -iname '*.txt' -execdir gzip -9 {} \+
|
|
find logs -iname '*.json' -execdir gzip -9 {} \+
|
|
executable: /bin/bash
|
|
chdir: "{{ zuul.project.src_dir }}"
|
|
|
|
- synchronize:
|
|
src: '{{ zuul.project.src_dir }}/logs'
|
|
dest: '{{ zuul.executor.log_root }}'
|
|
mode: pull
|
|
copy_links: true
|
|
verify_host: true
|