blob: 506c5a3ce37c95b94e1a3bc190b21193f8e422dd [file] [log] [blame]
Artem Senicheve57ee762018-11-13 11:06:18 +03001#!/bin/bash
2#
3# config: 123 20
4# @brief: Collect host's logs
5#
6
7. ${DREPORT_INCLUDE}/functions
8
9DESCRIPTION="Host logs"
10LOGS_PATH="/var/lib/obmc/hostlogs"
11
12if [[ -d ${LOGS_PATH} ]]; then
Patrick Williams9d26e4f2022-12-08 06:46:44 -060013 # Manual flush of the log buffer for all service instances
14 INSTANCES="$(systemctl list-units --type=service --state=running --full | \
Artem Senichev9b841d02020-07-15 15:53:01 +030015 awk '/hostlogger@/{print $1}')"
Patrick Williams9d26e4f2022-12-08 06:46:44 -060016 for SVC in ${INSTANCES}; do
17 log_info "Flush ${SVC}..."
18 if ! systemctl kill --signal SIGUSR1 ${SVC}; then
19 log_warning "Unable to flush ${SVC}"
20 fi
21 done
Artem Senichev9b841d02020-07-15 15:53:01 +030022
Patrick Williams9d26e4f2022-12-08 06:46:44 -060023 # Copy log directory
24 add_copy_file "${LOGS_PATH}" "${DESCRIPTION}"
Artem Senicheve57ee762018-11-13 11:06:18 +030025fi