How openbmc/phosphor-sel-logger works
Project type and purpose
• This is a Linux system daemon (“phosphor-sel-logger”) written in C++ with Meson build files.
• It exposes a D-Bus API for adding IPMI SEL records and embeds a collection of “event monitor” plugins that watch for D-Bus signals (e.g., sensor threshold changes) to auto-log SEL entries into the systemd journal.
File structure
• Top-level meson.build & meson.options: build definition for the daemon and its vendored dependencies.
• /: headers for the core SEL logger and each EventMonitor subclass (threshold, pulse, watchdog, host-error, threshold-alarm).
• src/sel_logger.cpp: the main daemon logic (initialization, D-Bus interface, plugin registration, journal calls).
• service_files/xyz.openbmc_project.Logging.IPMI.service: systemd unit that starts the daemon.
• subprojects/: vendored wraps for Boost, sdbusplus (D-Bus bindings), and phosphor-logging (journal client).
Extract README insights
• The daemon registers a D-Bus interface to accept System-type and OEM-type SEL records (adding metadata fields, automatically generating MESSAGE_ID and RECORD_ID).
• It also instantiates EventMonitor objects that subscribe to D-Bus signals (e.g. PropertiesChanged on xyz.openbmc_project.Sensor.Threshold) and call the logging API when triggered.
a. External invokers & systems:
• systemd (launcher)
• D-Bus clients (IPMI management modules or CLI tools)
• Sensors & services on other D-Bus buses (xyz.openbmc_project.Sensor.* interfaces)
• systemd-journald (journal)
b. Internal SEL Logger Daemon:
• D-Bus server interface (“AddSystemSEL”, “AddOEMSEL” methods)
• EventMonitor Manager (factory/registry)
– ThresholdEventMonitor
– PulseEventMonitor
– WatchdogEventMonitor
– HostErrorEventMonitor
– ThresholdAlarmEventMonitor
• phosphor-logging client (wrap around sd_journal_send with MESSAGE_ID + metadata)
c. Vendored Libraries (build-time):
• sdbusplus – D-Bus C++ bindings
• phosphor-logging – Journal client helpers
• Boost – utilities
Relationships and data flows
2. SEL Logger registers its D-Bus interface (sdbusplus) on the bus.
6. On sensor events, monitors invoke SEL Logger’s internal logging routines → journald.
Architectural patterns & design principles
• Modular “plugin” monitors, each implementing a common interface (Observer pattern for D-Bus signals).
• Single-process daemon with separation of concerns: D-Bus API, event subscription, metadata construction, journald writing.
• Build-time vendoring isolates external dependencies (Boost, sdbusplus, phosphor-logging).
Final remarks
• Shared use of sdbusplus and phosphor-logging inside the daemon.