Add SEL_LOGGER_SEND_TO_LOGGING_SERVICE option

When enabled, the sel logger sends the SEL data to logging service
instead of journal.

The logging service will create a logging entry with related metadata,
so that it could be used for ipmid to convert to SEL entry.

Tested: Verify the logging entry is created as below example:

    # Add OEM SEL
    busctl call "xyz.openbmc_project.Logging.IPMI" "/xyz/openbmc_project/Logging/IPMI" xyz.openbmc_project.Logging.IPMI IpmiSelAddOem sayy "b370836ccf2f4850ac5bee185b77893a" 9 0x00 0xdd 0xb3 0xba 0xcd 0x00 0x01 0x00 0x00 0xcd
    # logging entry:
    "data": {
      "AdditionalData": [
        "EVENT_DIR=0",
        "GENERATE_ID=0",
        "IS_OEM=1",
        "RECORD_TYPE=205",
        "SENSOR_DATA=00DDB3BACD00010000",
        "SENSOR_PATH=",
        "_PID=198"
      ],
      "Associations": [],
      "Id": 1,
      "Message": "xyz.openbmc_project.Logging.SEL.Error.Created",
      "Purpose": "xyz.openbmc_project.Software.Version.VersionPurpose.BMC",
      "Resolved": false,
      "Severity": "xyz.openbmc_project.Logging.Entry.Level.Informational",
      "Timestamp": 86022,
      "UpdateTimestamp": 86022,
      "Version": "2.9.0-dev-1308-g01b7feb91-dirty"
    },

    # Add regular SEL record
    busctl call "xyz.openbmc_project.Logging.IPMI" "/xyz/openbmc_project/Logging/IPMI" xyz.openbmc_project.Logging.IPMI IpmiSelAdd ssaybq "MyTestMessage" "InvalidPath" 3 0x01 0x02 0x03 true 0x2000
    # logging entry:
    "data": {
      "AdditionalData": [
        "EVENT_DIR=1",
        "GENERATE_ID=8192",
        "IS_OEM=0",
        "RECORD_TYPE=2",
        "SENSOR_DATA=010203",
        "SENSOR_PATH=InvalidPath",
        "_PID=512"
      ],
      "Associations": [],
      "Id": 2,
      "Message": "xyz.openbmc_project.Logging.SEL.Error.Created",
      "Purpose": "xyz.openbmc_project.Software.Version.VersionPurpose.BMC",
      "Resolved": false,
      "Severity": "xyz.openbmc_project.Logging.Entry.Level.Informational",
      "Timestamp": 458713,
      "UpdateTimestamp": 458713,
      "Version": "2.9.0-dev-1312-g30641eb10"
    },

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I01aa0af2b9ba6211d1f447106f82cfa264ef877a
2 files changed
tree: 70453cd8ac8358e8a9fc3ef41dd9b03e25c700e1
  1. include/
  2. service_files/
  3. src/
  4. .clang-format
  5. cmake-format.json
  6. CMakeLists.txt
  7. LICENSE
  8. MAINTAINERS
  9. README.md
README.md

phosphor-sel-logger

Overview

The SEL Logger daemon handles all requests to add new IPMI SEL records to the journal. SEL records stored in the journal are identified by the standard MESSAGE_ID metadata. Other metadata fields are used to store event-specific information for each record.

Metadata

SEL records are identified in the journal using the MESSAGE_ID field.

The MESSAGE_ID for SEL records is "b370836ccf2f4850ac5bee185b77893a".

The additional metadata fields for a SEL record are

IPMI_SEL_RECORD_ID = Two byte unique SEL Record ID
IPMI_SEL_RECORD_TYPE = The type of SEL entry (system or OEM)
                       which determines the definition of the
                       remaining bytes
IPMI_SEL_GENERATOR_ID = The IPMI Generator ID (usually the
                        IPMB Slave Address) of the requester
IPMI_SEL_SENSOR_PATH = D-Bus path of the sensor in the event
IPMI_SEL_EVENT_DIR = Direction of the event (assert or deassert)
IPMI_SEL_DATA = Raw binary data included in the SEL record

Interface

The SEL Logger daemon exposes an interface for manually adding System and OEM type SEL events, and provides the capability to monitor for types of events and log them automatically.

The interface for System type events requires

  • A text message to include in the journal entry
  • The sensor path
  • Up to three bytes of SEL data
  • The direction of the event (assertion or deassertion)
  • The generator ID of the requester

The interface for OEM type events requires

  • A text message to include in the journal entry
  • Up to thirteen bytes of SEL data (depending on the record type)
  • The record type

The MESSAGE_ID and IPMI_SEL_RECORD_ID metadata fields are added by the daemon.

Event Monitoring

The SEL Logger daemon can be configured to watch for specific types of events and automatically log SEL records for them.

As an example, the SEL Logger has a "threshold event monitor" which implements a D-Bus match for any "PropertiesChanged" event on the "xyz.openbmc_project.Sensor.Threshold" interface. The handler then checks for any new threshold events and logs SEL records accordingly.