On such platforms where rsyslog.conf doesn't exist (e.g. Fedora 34
Vagrant image), assume that logs can be extracted using journalctl.
An alternative would be to attempt to install rsyslog but let's try
this first.
Signed-off-by: Martin Schwenke <martin@meltin.net>
---
+- name: check for rsyslog.conf
+ stat:
+ path: /etc/rsyslog.conf
+ register: p
# Note that this only configures the high-resolution timestamp format.
# It doesn't turn off rate limiting (if it defaults to on) and it
path: /etc/rsyslog.conf
regexp: RSYSLOG_TraditionalFileFormat
replace: RSYSLOG_FileFormat
+ when: p.stat.exists
notify:
- restart rsyslog
copy:
src: rsyslog.conf
dest: /etc/rsyslog.d/autocluster.conf
+ when: p.stat.exists
notify:
- restart rsyslog
_log_dir="$1"
for _n in $(ssh -n "$ctest_node" onnode -q all hostname) ; do
- scp -q "${_n}:/var/log/messages" "${_log_dir}/${_n}.messages"
+ _log_file="${_log_dir}/${_n}.messages"
+ if ssh -n "$_n" test -f /var/log/messages ; then
+ scp -q "${_n}:/var/log/messages" "$_log_file"
+ else
+ ssh -n "$_n" \
+ journalctl -q -o short-iso-precise >"$_log_file"
+ fi
done
}