Add multi-host support
This refactoring includes:
- added multi-host mode support;
- added support for graceful shutdown of the service;
- added support to flush the log buffer as it fills;
- D-Bus service xyz.openbmc_project.HostLogger replaced with SIGUSR1
signal handler;
- self diagnostic messages now registered via phosphor-logging;
- added unit tests;
- build system migrated from autotools to meson;
- source code aligned with OpenBMC conventions.
Change-Id: If6c1dfde278af685d8563450543a6587a282c7e4
Signed-off-by: Artem Senichev <a.senichev@yadro.com>
diff --git a/hostlogger.dreport b/hostlogger.dreport
new file mode 100644
index 0000000..1832453
--- /dev/null
+++ b/hostlogger.dreport
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# config: 123 20
+# @brief: Collect host's logs
+#
+
+. ${DREPORT_INCLUDE}/functions
+
+DESCRIPTION="Host logs"
+LOGS_PATH="/var/lib/obmc/hostlogs"
+
+if [[ -d ${LOGS_PATH} ]]; then
+ # Manual flush of the log buffer for all service instances
+ INSTANCES="$(systemctl list-units --type=service --state=running --full | \
+ awk '/hostlogger@/{print $1}')"
+ for SVC in ${INSTANCES}; do
+ log_info "Flush ${SVC}..."
+ if ! systemctl kill --signal SIGUSR1 ${SVC}; then
+ log_warning "Unable to flush ${SVC}"
+ fi
+ done
+
+ # Copy log directory
+ add_copy_file "${LOGS_PATH}" "${DESCRIPTION}"
+fi