Merge "Zuul v3: export devstack journal"
This commit is contained in:
commit
e8943cfee7
|
@ -1,3 +1,4 @@
|
||||||
- hosts: all
|
- hosts: all
|
||||||
roles:
|
roles:
|
||||||
|
- export-devstack-journal
|
||||||
- fetch-devstack-log-dir
|
- fetch-devstack-log-dir
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
Export journal files from devstack services
|
||||||
|
|
||||||
|
Export the systemd journal for every devstack service in native
|
||||||
|
journal format as well as text. Also, export a syslog-style file with
|
||||||
|
kernal and sudo messages.
|
||||||
|
|
||||||
|
Writes the output to the ``logs/`` subdirectory of
|
||||||
|
``devstack_base_dir``.
|
||||||
|
|
||||||
|
**Role Variables**
|
||||||
|
|
||||||
|
.. zuul:rolevar:: devstack_base_dir
|
||||||
|
:default: /opt/stack
|
||||||
|
|
||||||
|
The devstack base directory.
|
|
@ -0,0 +1 @@
|
||||||
|
devstack_base_dir: /opt/stack
|
|
@ -0,0 +1,29 @@
|
||||||
|
# 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 | tee {{ devstack_base_dir }}/logs/$name.txt > /dev/null
|
||||||
|
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 - > {{ devstack_base_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)" \
|
||||||
|
| tee {{ devstack_base_dir }}/logs/syslog.txt > /dev/null
|
Loading…
Reference in New Issue