dbus event subscription: add timestamp
Get the timestamp from dbus
xyz.openbmc_project.Logging.Entry 'Timestamp' property.
This is then transformed into 'EventTimestamp' property.
Tested: Manually tested [1]
This is already done in this way for the polling api,
in log_services.hpp
1455 objectToFillOut["Created"] =
1456 redfish::time_utils::getDateTimeUintMs(entry.Timestamp);
using the same function. So there is nothing new here.
[1] https://discord.com/channels/775381525260664832/1285909954095616050/1327330501937205382
Change-Id: I49670b13d609ac54a5c9d21da9ff1697c7524b5d
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/redfish-core/src/dbus_log_watcher.cpp b/redfish-core/src/dbus_log_watcher.cpp
index b1e8455..2c30ff2 100644
--- a/redfish-core/src/dbus_log_watcher.cpp
+++ b/redfish-core/src/dbus_log_watcher.cpp
@@ -7,6 +7,7 @@
#include "logging.hpp"
#include "metric_report.hpp"
#include "utils/dbus_event_log_entry.hpp"
+#include "utils/time_utils.hpp"
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/message.hpp>
@@ -20,6 +21,7 @@
namespace redfish
{
+
static bool eventLogObjectFromDBus(const dbus::utility::DBusPropertiesMap& map,
EventLogObjectsType& event)
{
@@ -34,6 +36,7 @@
}
DbusEventLogEntry& entry = optEntry.value();
event.id = std::to_string(entry.Id);
+ event.timestamp = redfish::time_utils::getDateTimeUintMs(entry.Timestamp);
// The order of 'AdditionalData' is not what's specified in an e.g.
// busctl call to create the Event Log Entry. So it cannot be used