Clark Boylan 2700bf88a5 Gzip openstack service logs
These files are quite large and disk space is limited so make sure we
compress the log files before copying them to storage. Additionally
os-loganalyze will only operate on gzipped log files so this should fix
os-loganalyze with tempest-full job's logs.

This is mostly a check to confirm everything works as expected but we
probably want to move the gzip step into the log publication roles so
that all log files end up compressed.

Change-Id: Ie87962428e0ca755c211cc5e664a14a9f2a79ac4
2018-01-04 10:17:24 -08:00

38 lines
1.4 KiB
YAML

# NOTE(andreaf) This bypasses the stage-output role
- name: Ensure {{ stage_dir }}/logs exists
become: true
file:
path: "{{ stage_dir }}/logs"
state: directory
owner: "{{ ansible_user }}"
# TODO: convert this to ansible
- name: Export journal files
become: true
shell:
cmd: |
u=""
name=""
for u in `systemctl list-unit-files | grep devstack | awk '{print $1}'`; do
name=$(echo $u | sed 's/devstack@/screen-/' | sed 's/\.service//')
journalctl -o short-precise --unit $u | gzip - > {{ stage_dir }}/logs/$name.txt.gz
done
# Export the journal in export format to make it downloadable
# for later searching. It can then be rewritten to a journal native
# format locally using systemd-journal-remote. This makes a class of
# debugging much easier. We don't do the native conversion here as
# some distros do not package that tooling.
journalctl -u 'devstack@*' -o export | \
xz --threads=0 - > {{ stage_dir }}/logs/devstack.journal.xz
# The journal contains everything running under systemd, we'll
# build an old school version of the syslog with just the
# kernel and sudo messages.
journalctl \
-t kernel \
-t sudo \
--no-pager \
--since="$(cat {{ devstack_base_dir }}/log-start-timestamp.txt)" \
| gzip - > {{ stage_dir }}/logs/syslog.txt.gz