blob: 564721c0db4bc6b50c9218c15262efc6bb444e4c [file] [log] [blame]
Artem Senicheve8837d52020-06-07 11:59:04 +03001#!/bin/bash
2#
3# config: 123 20
4# @brief: Collect host's logs
5#
6
Patrick Williamsdfee0da2021-04-13 21:38:11 -05007# shellcheck disable=SC1090 # library comes from phosphor-debug-collector repo.
8. "${DREPORT_INCLUDE}/functions"
Artem Senicheve8837d52020-06-07 11:59:04 +03009
10DESCRIPTION="Host logs"
11LOGS_PATH="/var/lib/obmc/hostlogs"
12
13if [[ -d ${LOGS_PATH} ]]; then
14 # Manual flush of the log buffer for all service instances
15 INSTANCES="$(systemctl list-units --type=service --state=running --full | \
16 awk '/hostlogger@/{print $1}')"
17 for SVC in ${INSTANCES}; do
18 log_info "Flush ${SVC}..."
Patrick Williamsdfee0da2021-04-13 21:38:11 -050019 if ! systemctl kill --signal SIGUSR1 "${SVC}"; then
Artem Senicheve8837d52020-06-07 11:59:04 +030020 log_warning "Unable to flush ${SVC}"
21 fi
22 done
23
24 # Copy log directory
25 add_copy_file "${LOGS_PATH}" "${DESCRIPTION}"
26fi