Artem Senichev | e8837d5 | 2020-06-07 11:59:04 +0300 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # config: 123 20 |
| 4 | # @brief: Collect host's logs |
| 5 | # |
| 6 | |
Patrick Williams | dfee0da | 2021-04-13 21:38:11 -0500 | [diff] [blame] | 7 | # shellcheck disable=SC1090 # library comes from phosphor-debug-collector repo. |
| 8 | . "${DREPORT_INCLUDE}/functions" |
Artem Senichev | e8837d5 | 2020-06-07 11:59:04 +0300 | [diff] [blame] | 9 | |
| 10 | DESCRIPTION="Host logs" |
| 11 | LOGS_PATH="/var/lib/obmc/hostlogs" |
| 12 | |
| 13 | if [[ -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 Williams | dfee0da | 2021-04-13 21:38:11 -0500 | [diff] [blame] | 19 | if ! systemctl kill --signal SIGUSR1 "${SVC}"; then |
Artem Senichev | e8837d5 | 2020-06-07 11:59:04 +0300 | [diff] [blame] | 20 | log_warning "Unable to flush ${SVC}" |
| 21 | fi |
| 22 | done |
| 23 | |
| 24 | # Copy log directory |
| 25 | add_copy_file "${LOGS_PATH}" "${DESCRIPTION}" |
| 26 | fi |