Update the CPU Log Timestamp location
The CPU Log timestamp was moved to a new location in the schema,
so this looks in the new place to get the timestamp for the
Created field.
Tested: Verified that the Created field is correctly populated in
the LogEntry.
Change-Id: Ie90e169aa999284ebc009867634beb35a4e74587
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 866238b..da4c5ab 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1041,16 +1041,21 @@
std::string getLogCreatedTime(const nlohmann::json &cpuLog)
{
- nlohmann::json::const_iterator metaIt = cpuLog.find("metadata");
- if (metaIt != cpuLog.end())
+ nlohmann::json::const_iterator cdIt = cpuLog.find("crashlog_data");
+ if (cdIt != cpuLog.end())
{
- nlohmann::json::const_iterator tsIt = metaIt->find("timestamp");
- if (tsIt != metaIt->end())
+ nlohmann::json::const_iterator siIt = cdIt->find("SYSTEM_INFO");
+ if (siIt != cdIt->end())
{
- const std::string *logTime = tsIt->get_ptr<const std::string *>();
- if (logTime != nullptr)
+ nlohmann::json::const_iterator tsIt = siIt->find("timestamp");
+ if (tsIt != siIt->end())
{
- return *logTime;
+ const std::string *logTime =
+ tsIt->get_ptr<const std::string *>();
+ if (logTime != nullptr)
+ {
+ return *logTime;
+ }
}
}
}