blob: 8555fd066576f7834420e9481e23c70a0f32e784 [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 Williamsc8047cf2022-12-03 06:40:44 -06007# shellcheck source=/dev/null # library comes from phosphor-debug-collector repo.
Patrick Williamsdfee0da2021-04-13 21:38:11 -05008. "${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