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 | c8047cf | 2022-12-03 06:40:44 -0600 | [diff] [blame] | 7 | # shellcheck source=/dev/null # library comes from phosphor-debug-collector repo. |
Patrick Williams | dfee0da | 2021-04-13 21:38:11 -0500 | [diff] [blame] | 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 |
Patrick Williams | bb4e093 | 2022-12-08 06:23:27 -0600 | [diff] [blame] | 14 | # Manual flush of the log buffer for all service instances |
| 15 | INSTANCES="$(systemctl list-units --type=service --state=running --full | \ |
Artem Senichev | e8837d5 | 2020-06-07 11:59:04 +0300 | [diff] [blame] | 16 | awk '/hostlogger@/{print $1}')" |
Patrick Williams | bb4e093 | 2022-12-08 06:23:27 -0600 | [diff] [blame] | 17 | for SVC in ${INSTANCES}; do |
| 18 | log_info "Flush ${SVC}..." |
| 19 | if ! systemctl kill --signal SIGUSR1 "${SVC}"; then |
| 20 | log_warning "Unable to flush ${SVC}" |
| 21 | fi |
| 22 | done |
Artem Senichev | e8837d5 | 2020-06-07 11:59:04 +0300 | [diff] [blame] | 23 | |
Patrick Williams | bb4e093 | 2022-12-08 06:23:27 -0600 | [diff] [blame] | 24 | # Copy log directory |
| 25 | add_copy_file "${LOGS_PATH}" "${DESCRIPTION}" |
Artem Senichev | e8837d5 | 2020-06-07 11:59:04 +0300 | [diff] [blame] | 26 | fi |