Make SEL logger messages more informative
Currently log entries are created using the "report" function from the
phosphor-logging repo. The problem is that function uses YAML file
"SEL.errors.yaml" for the message content. This leaves no space for the
message customization. And because of that webui displays all SEL
messages with a description
"xyz.openbmc_project.Logging.SEL.Error.Created" which is not very
informative.
To correct that switch to using "xyz.openbmc_project.Logging.Create"
function directly and create message content dynamically from all of
the incoming parameters.
Example of a SEL message description in webui:
- Before: "xyz.openbmc_project.Logging.SEL.Error.Created"
- After: "SEL Entry from System: RecordType=2, GeneratorID=65,
EventDir=1, EventData=01"
Change-Id: Iba17bd4c1834dd804c2eec04879fe226de2dfef7
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
diff --git a/include/host_error_event_monitor.hpp b/include/host_error_event_monitor.hpp
index 5f6242d..9375800 100644
--- a/include/host_error_event_monitor.hpp
+++ b/include/host_error_event_monitor.hpp
@@ -28,7 +28,8 @@
{"ThermalTrip", thermTripEventMatcher}, {"IERR", ierrEventMatcher}};
static boost::container::flat_set<std::string> hostErrorEvents;
-void hostErrorEventMonitor(sdbusplus::message_t& msg)
+void hostErrorEventMonitor(std::shared_ptr<sdbusplus::asio::connection> conn,
+ sdbusplus::message_t& msg)
{
std::string msgInterface;
boost::container::flat_map<std::string, std::variant<bool>> values;
@@ -71,7 +72,7 @@
uint8_t selType = (msgInterface.ends_with("ThermalTrip")) ? 0x01 : 0x00;
std::vector<uint8_t> selData{selType, 0xff, 0xff};
- selAddSystemRecord(message, objectPath, selData, assert, selBMCGenID);
+ selAddSystemRecord(conn, message, objectPath, selData, assert, selBMCGenID);
}
inline static void startHostErrorEventMonitor(
@@ -87,7 +88,7 @@
"HostErrorMonitor.Processor." +
iter->first + "'",
[conn, iter](sdbusplus::message_t& msg) {
- hostErrorEventMonitor(msg);
+ hostErrorEventMonitor(conn, msg);
});
}
}
diff --git a/include/sel_logger.hpp b/include/sel_logger.hpp
index 3d2e13c..1c9bc47 100644
--- a/include/sel_logger.hpp
+++ b/include/sel_logger.hpp
@@ -39,6 +39,7 @@
template <typename... T>
static void
- selAddSystemRecord(const std::string& message, const std::string& path,
+ selAddSystemRecord(std::shared_ptr<sdbusplus::asio::connection> conn,
+ const std::string& message, const std::string& path,
const std::vector<uint8_t>& selData, const bool& assert,
const uint16_t& genId, T&&... metadata);
diff --git a/include/threshold_alarm_event_monitor.hpp b/include/threshold_alarm_event_monitor.hpp
index bdfd3a9..0010d4b 100644
--- a/include/threshold_alarm_event_monitor.hpp
+++ b/include/threshold_alarm_event_monitor.hpp
@@ -238,7 +238,7 @@
". Reading=" + std::to_string(assertValue) +
" Threshold=" + std::to_string(thresholdVal) + ".");
- selAddSystemRecord(journalMsg, std::string(msg.get_path()), eventData,
+ selAddSystemRecord(conn, journalMsg, std::string(msg.get_path()), eventData,
assert, selBMCGenID, "REDFISH_MESSAGE_ID=%s",
redfishMessageID.c_str(),
"REDFISH_MESSAGE_ARGS=%.*s,%f,%f", sensorName.length(),
diff --git a/include/threshold_event_monitor.hpp b/include/threshold_event_monitor.hpp
index 61e4690..5b79a7a 100644
--- a/include/threshold_event_monitor.hpp
+++ b/include/threshold_event_monitor.hpp
@@ -325,7 +325,7 @@
}
#else
selAddSystemRecord(
- journalMsg, std::string(msg.get_path()), eventData, assert,
+ conn, journalMsg, std::string(msg.get_path()), eventData, assert,
selBMCGenID, "REDFISH_MESSAGE_ID=%s", redfishMessageID.c_str(),
"REDFISH_MESSAGE_ARGS=%.*s,%f,%f", sensorName.length(),
sensorName.data(), assertValue, thresholdVal);
diff --git a/include/watchdog_event_monitor.hpp b/include/watchdog_event_monitor.hpp
index facb282..777ac16 100644
--- a/include/watchdog_event_monitor.hpp
+++ b/include/watchdog_event_monitor.hpp
@@ -227,10 +227,10 @@
std::string redfishMessageID = "OpenBMC.0.1.IPMIWatchdog";
- selAddSystemRecord(journalMsg, std::string(msg.get_path()), eventData,
- assert, selBMCGenID, "REDFISH_MESSAGE_ID=%s",
- redfishMessageID.c_str(), "REDFISH_MESSAGE_ARGS=%s",
- eventMessageArgs.c_str(), NULL);
+ selAddSystemRecord(
+ conn, journalMsg, std::string(msg.get_path()), eventData, assert,
+ selBMCGenID, "REDFISH_MESSAGE_ID=%s", redfishMessageID.c_str(),
+ "REDFISH_MESSAGE_ARGS=%s", eventMessageArgs.c_str(), NULL);
}
}