Artem Senichev | e57ee76 | 2018-11-13 11:06:18 +0300 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # config: 123 20 |
| 4 | # @brief: Collect host's logs |
| 5 | # |
| 6 | |
| 7 | . ${DREPORT_INCLUDE}/functions |
| 8 | |
| 9 | DESCRIPTION="Host logs" |
| 10 | LOGS_PATH="/var/lib/obmc/hostlogs" |
| 11 | |
| 12 | if [[ -d ${LOGS_PATH} ]]; then |
Artem Senichev | 9b841d0 | 2020-07-15 15:53:01 +0300 | [diff] [blame] | 13 | # Manual flush of the log buffer for all service instances |
| 14 | INSTANCES="$(systemctl list-units --type=service --state=running --full | \ |
| 15 | awk '/hostlogger@/{print $1}')" |
| 16 | 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 |
| 22 | |
Artem Senichev | e57ee76 | 2018-11-13 11:06:18 +0300 | [diff] [blame] | 23 | # Copy log directory |
| 24 | add_copy_file "${LOGS_PATH}" "${DESCRIPTION}" |
| 25 | fi |