plugins/hostlogger: Replace dbus call with signal

The latest version of the Hostlogger supports multi-host mode, each host
is served by a separate service instance.
The service instance now uses SIG_USR1 signal to flush collected messages
to a file.

Tested: Run dreport inside the BMC console, the result dump archive
contains host console logs.

Change-Id: I2ba926dad79b362d0f4abac50619d7969a4f28f7
Signed-off-by: Artem Senichev <a.senichev@yadro.com>
Tested-by: Artem Senichev <a.senichev@yadro.com>
diff --git a/tools/dreport.d/plugins.d/hostlogger b/tools/dreport.d/plugins.d/hostlogger
index 8399f9f..1832453 100644
--- a/tools/dreport.d/plugins.d/hostlogger
+++ b/tools/dreport.d/plugins.d/hostlogger
@@ -10,10 +10,16 @@
 LOGS_PATH="/var/lib/obmc/hostlogs"
 
 if [[ -d ${LOGS_PATH} ]]; then
-  # Flush currently collected messages
-  busctl --no-pager --verbose call \
-    xyz.openbmc_project.HostLogger /xyz/openbmc_project/HostLogger \
-    xyz.openbmc_project.HostLogger Flush
+  # 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