summaryrefslogtreecommitdiffstats
path: root/phosphor-rsyslog-config/utils.hpp
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2018-08-23 02:19:58 -0500
committerDeepak Kodihalli <dkodihal@in.ibm.com>2018-08-29 03:38:49 -0500
commitc49661925b0c59a4355aca6813a85d749c21e764 (patch)
tree65d4ecebf593f3d77cd428bf3397f7d99f762006 /phosphor-rsyslog-config/utils.hpp
parent9067c077034cd92e0498646b7d7a05fba890532c (diff)
downloadphosphor-logging-c49661925b0c59a4355aca6813a85d749c21e764.tar.gz
phosphor-logging-c49661925b0c59a4355aca6813a85d749c21e764.zip
Add application to configure rsyslog
The application implements the xyz.openbmc_project.Network.Client D-Bus interface to set a remote rsyslog server's address and port in the rsyslog config file. This lets us configure rsyslog to be able to stream out logs. TODO: Exception handling and validation will be handled in subsequent commits. Change-Id: I8917daab3f0de1806d2f1aafe99cb3a872f19184 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'phosphor-rsyslog-config/utils.hpp')
-rw-r--r--phosphor-rsyslog-config/utils.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/phosphor-rsyslog-config/utils.hpp b/phosphor-rsyslog-config/utils.hpp
new file mode 100644
index 0000000..ea7984d
--- /dev/null
+++ b/phosphor-rsyslog-config/utils.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "config.h"
+#include <sdbusplus/bus.hpp>
+
+namespace phosphor
+{
+namespace rsyslog_utils
+{
+
+/** @brief Restart rsyslog's systemd unit
+ */
+void restart()
+{
+ auto bus = sdbusplus::bus::new_default();
+ auto method = bus.new_method_call(
+ SYSTEMD_BUSNAME,
+ SYSTEMD_PATH,
+ SYSTEMD_INTERFACE,
+ "RestartUnit");
+ method.append("rsyslog.service", "replace");
+ bus.call_noreply(method);
+}
+
+} // namespace rsyslog_utils
+} // namespace phosphor
OpenPOWER on IntegriCloud