Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2018 Intel Corporation |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | */ |
| 16 | #include <systemd/sd-journal.h> |
| 17 | |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 18 | #include <boost/algorithm/string.hpp> |
Ed Tanous | c352634 | 2023-03-06 13:37:53 -0800 | [diff] [blame] | 19 | #include <boost/asio/io_context.hpp> |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 20 | #include <boost/container/flat_map.hpp> |
| 21 | #include <boost/container/flat_set.hpp> |
Zhikui Ren | 672bdfc | 2020-07-14 11:37:01 -0700 | [diff] [blame] | 22 | #include <pulse_event_monitor.hpp> |
| 23 | #include <sdbusplus/asio/object_server.hpp> |
| 24 | #include <sel_logger.hpp> |
| 25 | #include <threshold_event_monitor.hpp> |
Charles Hsu | dbd77b9 | 2020-10-29 11:20:34 +0800 | [diff] [blame] | 26 | #include <watchdog_event_monitor.hpp> |
George Hung | 486e42e | 2021-04-14 20:20:42 +0800 | [diff] [blame] | 27 | #ifdef SEL_LOGGER_MONITOR_THRESHOLD_ALARM_EVENTS |
| 28 | #include <threshold_alarm_event_monitor.hpp> |
| 29 | #endif |
JinFuLin | 7c2810b | 2022-12-02 13:55:28 +0800 | [diff] [blame] | 30 | #ifdef SEL_LOGGER_MONITOR_HOST_ERROR_EVENTS |
| 31 | #include <host_error_event_monitor.hpp> |
| 32 | #endif |
Zhikui Ren | 672bdfc | 2020-07-14 11:37:01 -0700 | [diff] [blame] | 33 | |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 34 | #include <filesystem> |
| 35 | #include <fstream> |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 36 | #include <iomanip> |
| 37 | #include <iostream> |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 38 | #include <sstream> |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 39 | |
| 40 | struct DBusInternalError final : public sdbusplus::exception_t |
| 41 | { |
Zhikui Ren | 672bdfc | 2020-07-14 11:37:01 -0700 | [diff] [blame] | 42 | const char* name() const noexcept override |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 43 | { |
| 44 | return "org.freedesktop.DBus.Error.Failed"; |
Patrick Williams | a138ebd | 2021-09-08 15:46:34 -0500 | [diff] [blame] | 45 | } |
Zhikui Ren | 672bdfc | 2020-07-14 11:37:01 -0700 | [diff] [blame] | 46 | const char* description() const noexcept override |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 47 | { |
| 48 | return "internal error"; |
Patrick Williams | a138ebd | 2021-09-08 15:46:34 -0500 | [diff] [blame] | 49 | } |
Zhikui Ren | 672bdfc | 2020-07-14 11:37:01 -0700 | [diff] [blame] | 50 | const char* what() const noexcept override |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 51 | { |
| 52 | return "org.freedesktop.DBus.Error.Failed: " |
| 53 | "internal error"; |
Patrick Williams | a138ebd | 2021-09-08 15:46:34 -0500 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | int get_errno() const noexcept override |
| 57 | { |
| 58 | return EACCES; |
| 59 | } |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
Lei YU | e526b86 | 2020-12-03 15:41:59 +0800 | [diff] [blame] | 62 | #ifndef SEL_LOGGER_SEND_TO_LOGGING_SERVICE |
Zhikui Ren | 672bdfc | 2020-07-14 11:37:01 -0700 | [diff] [blame] | 63 | static bool getSELLogFiles(std::vector<std::filesystem::path>& selLogFiles) |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 64 | { |
| 65 | // Loop through the directory looking for ipmi_sel log files |
Zhikui Ren | 672bdfc | 2020-07-14 11:37:01 -0700 | [diff] [blame] | 66 | for (const std::filesystem::directory_entry& dirEnt : |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 67 | std::filesystem::directory_iterator(selLogDir)) |
| 68 | { |
| 69 | std::string filename = dirEnt.path().filename(); |
| 70 | if (boost::starts_with(filename, selLogFilename)) |
| 71 | { |
| 72 | // If we find an ipmi_sel log file, save the path |
| 73 | selLogFiles.emplace_back(selLogDir / filename); |
| 74 | } |
| 75 | } |
| 76 | // As the log files rotate, they are appended with a ".#" that is higher for |
| 77 | // the older logs. Since we don't expect more than 10 log files, we |
| 78 | // can just sort the list to get them in order from newest to oldest |
| 79 | std::sort(selLogFiles.begin(), selLogFiles.end()); |
| 80 | |
| 81 | return !selLogFiles.empty(); |
| 82 | } |
| 83 | |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 84 | static unsigned int initializeRecordId(void) |
| 85 | { |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 86 | std::vector<std::filesystem::path> selLogFiles; |
| 87 | if (!getSELLogFiles(selLogFiles)) |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 88 | { |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 89 | return selInvalidRecID; |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 90 | } |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 91 | std::ifstream logStream(selLogFiles.front()); |
| 92 | if (!logStream.is_open()) |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 93 | { |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 94 | return selInvalidRecID; |
| 95 | } |
| 96 | std::string line; |
| 97 | std::string newestEntry; |
| 98 | while (std::getline(logStream, line)) |
| 99 | { |
| 100 | newestEntry = line; |
| 101 | } |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 102 | |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 103 | std::vector<std::string> newestEntryFields; |
| 104 | boost::split(newestEntryFields, newestEntry, boost::is_any_of(" ,"), |
| 105 | boost::token_compress_on); |
| 106 | if (newestEntryFields.size() < 4) |
| 107 | { |
| 108 | return selInvalidRecID; |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 109 | } |
Jason M. Bills | c4a336f | 2019-04-23 10:43:10 -0700 | [diff] [blame] | 110 | |
| 111 | return std::stoul(newestEntryFields[1]); |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 112 | } |
| 113 | |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 114 | static unsigned int recordId = initializeRecordId(); |
| 115 | |
Alexander Hansen | 8c02319 | 2023-09-26 09:15:18 +0200 | [diff] [blame] | 116 | static void saveClearSelTimestamp() |
| 117 | { |
| 118 | int fd = open("/var/lib/ipmi/sel_erase_time", |
| 119 | O_WRONLY | O_CREAT | O_CLOEXEC, 0644); |
| 120 | if (fd < 0) |
| 121 | { |
| 122 | std::cerr << "Failed to open file\n"; |
| 123 | return; |
| 124 | } |
| 125 | |
| 126 | if (futimens(fd, NULL) < 0) |
| 127 | { |
| 128 | std::cerr << "Failed to update SEL cleared timestamp: " |
| 129 | << std::string(strerror(errno)); |
| 130 | } |
| 131 | close(fd); |
| 132 | } |
| 133 | |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 134 | void clearSelLogFiles() |
| 135 | { |
Alexander Hansen | 8c02319 | 2023-09-26 09:15:18 +0200 | [diff] [blame] | 136 | saveClearSelTimestamp(); |
| 137 | |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 138 | // Clear the SEL by deleting the log files |
| 139 | std::vector<std::filesystem::path> selLogFiles; |
| 140 | if (getSELLogFiles(selLogFiles)) |
| 141 | { |
| 142 | for (const std::filesystem::path& file : selLogFiles) |
| 143 | { |
| 144 | std::error_code ec; |
| 145 | std::filesystem::remove(file, ec); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | recordId = selInvalidRecID; |
| 150 | |
| 151 | // Reload rsyslog so it knows to start new log files |
Ed Tanous | c352634 | 2023-03-06 13:37:53 -0800 | [diff] [blame] | 152 | boost::asio::io_context io; |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 153 | auto dbus = std::make_shared<sdbusplus::asio::connection>(io); |
Patrick Williams | ccef227 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 154 | sdbusplus::message_t rsyslogReload = dbus->new_method_call( |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 155 | "org.freedesktop.systemd1", "/org/freedesktop/systemd1", |
| 156 | "org.freedesktop.systemd1.Manager", "ReloadUnit"); |
| 157 | rsyslogReload.append("rsyslog.service", "replace"); |
| 158 | try |
| 159 | { |
Patrick Williams | ccef227 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 160 | sdbusplus::message_t reloadResponse = dbus->call(rsyslogReload); |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 161 | } |
Patrick Williams | 3f4cd97 | 2021-10-06 12:42:50 -0500 | [diff] [blame] | 162 | catch (const sdbusplus::exception_t& e) |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 163 | { |
| 164 | std::cerr << e.what() << "\n"; |
| 165 | } |
| 166 | } |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 167 | |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 168 | static unsigned int getNewRecordId(void) |
| 169 | { |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 170 | if (++recordId >= selInvalidRecID) |
| 171 | { |
| 172 | recordId = 1; |
| 173 | } |
| 174 | return recordId; |
| 175 | } |
Lei YU | e526b86 | 2020-12-03 15:41:59 +0800 | [diff] [blame] | 176 | #endif |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 177 | |
Zhikui Ren | 672bdfc | 2020-07-14 11:37:01 -0700 | [diff] [blame] | 178 | static void toHexStr(const std::vector<uint8_t>& data, std::string& hexStr) |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 179 | { |
| 180 | std::stringstream stream; |
| 181 | stream << std::hex << std::uppercase << std::setfill('0'); |
William A. Kennington III | 2e43726 | 2021-07-30 12:04:19 -0700 | [diff] [blame] | 182 | for (int v : data) |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 183 | { |
| 184 | stream << std::setw(2) << v; |
| 185 | } |
| 186 | hexStr = stream.str(); |
| 187 | } |
| 188 | |
Jason M. Bills | 97be353 | 2018-11-02 13:09:16 -0700 | [diff] [blame] | 189 | template <typename... T> |
Vincent Chou | 9272150 | 2024-01-24 15:09:24 -0600 | [diff] [blame^] | 190 | static uint16_t selAddSystemRecord( |
Konstantin Aladyshev | 6f5342d | 2023-04-19 09:23:11 +0000 | [diff] [blame] | 191 | [[maybe_unused]] std::shared_ptr<sdbusplus::asio::connection> conn, |
| 192 | [[maybe_unused]] const std::string& message, const std::string& path, |
| 193 | const std::vector<uint8_t>& selData, const bool& assert, |
| 194 | const uint16_t& genId, [[maybe_unused]] T&&... metadata) |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 195 | { |
| 196 | // Only 3 bytes of SEL event data are allowed in a system record |
| 197 | if (selData.size() > selEvtDataMaxSize) |
| 198 | { |
| 199 | throw std::invalid_argument("Event data too large"); |
| 200 | } |
| 201 | std::string selDataStr; |
| 202 | toHexStr(selData, selDataStr); |
| 203 | |
Lei YU | e526b86 | 2020-12-03 15:41:59 +0800 | [diff] [blame] | 204 | #ifdef SEL_LOGGER_SEND_TO_LOGGING_SERVICE |
Konstantin Aladyshev | 6f5342d | 2023-04-19 09:23:11 +0000 | [diff] [blame] | 205 | sdbusplus::message_t AddToLog = conn->new_method_call( |
| 206 | "xyz.openbmc_project.Logging", "/xyz/openbmc_project/logging", |
| 207 | "xyz.openbmc_project.Logging.Create", "Create"); |
| 208 | |
| 209 | std::string journalMsg(message + " from " + path + ": " + |
| 210 | " RecordType=" + std::to_string(selSystemType) + |
| 211 | ", GeneratorID=" + std::to_string(genId) + |
| 212 | ", EventDir=" + std::to_string(assert) + |
| 213 | ", EventData=" + selDataStr); |
| 214 | |
| 215 | AddToLog.append(journalMsg, |
| 216 | "xyz.openbmc_project.Logging.Entry.Level.Informational", |
| 217 | std::map<std::string, std::string>( |
| 218 | {{"SENSOR_PATH", path}, |
| 219 | {"GENERATOR_ID", std::to_string(genId)}, |
| 220 | {"RECORD_TYPE", std::to_string(selSystemType)}, |
| 221 | {"EVENT_DIR", std::to_string(assert)}, |
| 222 | {"SENSOR_DATA", selDataStr}})); |
| 223 | conn->call(AddToLog); |
Vincent Chou | 9272150 | 2024-01-24 15:09:24 -0600 | [diff] [blame^] | 224 | return 0; |
Lei YU | e526b86 | 2020-12-03 15:41:59 +0800 | [diff] [blame] | 225 | #else |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 226 | unsigned int recordId = getNewRecordId(); |
Jason M. Bills | 97be353 | 2018-11-02 13:09:16 -0700 | [diff] [blame] | 227 | sd_journal_send("MESSAGE=%s", message.c_str(), "PRIORITY=%i", selPriority, |
| 228 | "MESSAGE_ID=%s", selMessageId, "IPMI_SEL_RECORD_ID=%d", |
| 229 | recordId, "IPMI_SEL_RECORD_TYPE=%x", selSystemType, |
| 230 | "IPMI_SEL_GENERATOR_ID=%x", genId, |
| 231 | "IPMI_SEL_SENSOR_PATH=%s", path.c_str(), |
| 232 | "IPMI_SEL_EVENT_DIR=%x", assert, "IPMI_SEL_DATA=%s", |
| 233 | selDataStr.c_str(), std::forward<T>(metadata)..., NULL); |
Vincent Chou | 9272150 | 2024-01-24 15:09:24 -0600 | [diff] [blame^] | 234 | return recordId; |
Lei YU | e526b86 | 2020-12-03 15:41:59 +0800 | [diff] [blame] | 235 | #endif |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 236 | } |
| 237 | |
Vincent Chou | 9272150 | 2024-01-24 15:09:24 -0600 | [diff] [blame^] | 238 | static uint16_t selAddOemRecord( |
Konstantin Aladyshev | 6f5342d | 2023-04-19 09:23:11 +0000 | [diff] [blame] | 239 | [[maybe_unused]] std::shared_ptr<sdbusplus::asio::connection> conn, |
| 240 | [[maybe_unused]] const std::string& message, |
| 241 | const std::vector<uint8_t>& selData, const uint8_t& recordType) |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 242 | { |
| 243 | // A maximum of 13 bytes of SEL event data are allowed in an OEM record |
| 244 | if (selData.size() > selOemDataMaxSize) |
| 245 | { |
| 246 | throw std::invalid_argument("Event data too large"); |
| 247 | } |
| 248 | std::string selDataStr; |
| 249 | toHexStr(selData, selDataStr); |
| 250 | |
Lei YU | e526b86 | 2020-12-03 15:41:59 +0800 | [diff] [blame] | 251 | #ifdef SEL_LOGGER_SEND_TO_LOGGING_SERVICE |
Konstantin Aladyshev | 6f5342d | 2023-04-19 09:23:11 +0000 | [diff] [blame] | 252 | sdbusplus::message_t AddToLog = conn->new_method_call( |
| 253 | "xyz.openbmc_project.Logging", "/xyz/openbmc_project/logging", |
| 254 | "xyz.openbmc_project.Logging.Create", "Create"); |
| 255 | |
| 256 | std::string journalMsg( |
| 257 | message + ": " + " RecordType=" + std::to_string(recordType) + |
| 258 | ", GeneratorID=" + std::to_string(0) + |
| 259 | ", EventDir=" + std::to_string(0) + ", EventData=" + selDataStr); |
| 260 | |
| 261 | AddToLog.append(journalMsg, |
| 262 | "xyz.openbmc_project.Logging.Entry.Level.Informational", |
| 263 | std::map<std::string, std::string>( |
| 264 | {{"SENSOR_PATH", ""}, |
| 265 | {"GENERATOR_ID", std::to_string(0)}, |
| 266 | {"RECORD_TYPE", std::to_string(recordType)}, |
| 267 | {"EVENT_DIR", std::to_string(0)}, |
| 268 | {"SENSOR_DATA", selDataStr}})); |
| 269 | conn->call(AddToLog); |
Vincent Chou | 9272150 | 2024-01-24 15:09:24 -0600 | [diff] [blame^] | 270 | return 0; |
Lei YU | e526b86 | 2020-12-03 15:41:59 +0800 | [diff] [blame] | 271 | #else |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 272 | unsigned int recordId = getNewRecordId(); |
| 273 | sd_journal_send("MESSAGE=%s", message.c_str(), "PRIORITY=%i", selPriority, |
| 274 | "MESSAGE_ID=%s", selMessageId, "IPMI_SEL_RECORD_ID=%d", |
| 275 | recordId, "IPMI_SEL_RECORD_TYPE=%x", recordType, |
| 276 | "IPMI_SEL_DATA=%s", selDataStr.c_str(), NULL); |
Vincent Chou | 9272150 | 2024-01-24 15:09:24 -0600 | [diff] [blame^] | 277 | return recordId; |
Lei YU | e526b86 | 2020-12-03 15:41:59 +0800 | [diff] [blame] | 278 | #endif |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 279 | } |
| 280 | |
William A. Kennington III | d585c59 | 2021-07-30 12:10:25 -0700 | [diff] [blame] | 281 | int main(int, char*[]) |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 282 | { |
| 283 | // setup connection to dbus |
Ed Tanous | c352634 | 2023-03-06 13:37:53 -0800 | [diff] [blame] | 284 | boost::asio::io_context io; |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 285 | auto conn = std::make_shared<sdbusplus::asio::connection>(io); |
| 286 | |
| 287 | // IPMI SEL Object |
| 288 | conn->request_name(ipmiSelObject); |
| 289 | auto server = sdbusplus::asio::object_server(conn); |
| 290 | |
| 291 | // Add SEL Interface |
| 292 | std::shared_ptr<sdbusplus::asio::dbus_interface> ifaceAddSel = |
| 293 | server.add_interface(ipmiSelPath, ipmiSelAddInterface); |
| 294 | |
| 295 | // Add a new SEL entry |
| 296 | ifaceAddSel->register_method( |
Konstantin Aladyshev | 6f5342d | 2023-04-19 09:23:11 +0000 | [diff] [blame] | 297 | "IpmiSelAdd", |
| 298 | [conn](const std::string& message, const std::string& path, |
| 299 | const std::vector<uint8_t>& selData, const bool& assert, |
| 300 | const uint16_t& genId) { |
| 301 | return selAddSystemRecord(conn, message, path, selData, assert, genId); |
Patrick Williams | c68ea05 | 2023-10-20 11:19:00 -0500 | [diff] [blame] | 302 | }); |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 303 | // Add a new OEM SEL entry |
Patrick Williams | 69f7fa3 | 2023-05-10 07:50:41 -0500 | [diff] [blame] | 304 | ifaceAddSel->register_method("IpmiSelAddOem", |
Konstantin Aladyshev | 6f5342d | 2023-04-19 09:23:11 +0000 | [diff] [blame] | 305 | [conn](const std::string& message, |
| 306 | const std::vector<uint8_t>& selData, |
| 307 | const uint8_t& recordType) { |
| 308 | return selAddOemRecord(conn, message, selData, recordType); |
Patrick Williams | 69f7fa3 | 2023-05-10 07:50:41 -0500 | [diff] [blame] | 309 | }); |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 310 | |
Charles Boyer | 9f476e8 | 2021-07-29 16:33:01 -0500 | [diff] [blame] | 311 | #ifndef SEL_LOGGER_SEND_TO_LOGGING_SERVICE |
| 312 | // Clear SEL entries |
| 313 | ifaceAddSel->register_method("Clear", []() { clearSelLogFiles(); }); |
| 314 | #endif |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 315 | ifaceAddSel->initialize(); |
| 316 | |
| 317 | #ifdef SEL_LOGGER_MONITOR_THRESHOLD_EVENTS |
Patrick Williams | ccef227 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 318 | sdbusplus::bus::match_t thresholdAssertMonitor = |
Zhikui Ren | 25b26e1 | 2020-06-26 20:18:19 -0700 | [diff] [blame] | 319 | startThresholdAssertMonitor(conn); |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 320 | #endif |
| 321 | |
Nikhil Potade | afbaa09 | 2019-03-06 16:18:13 -0800 | [diff] [blame] | 322 | #ifdef REDFISH_LOG_MONITOR_PULSE_EVENTS |
Patrick Williams | ccef227 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 323 | sdbusplus::bus::match_t pulseEventMonitor = startPulseEventMonitor(conn); |
Nikhil Potade | afbaa09 | 2019-03-06 16:18:13 -0800 | [diff] [blame] | 324 | #endif |
| 325 | |
Charles Hsu | dbd77b9 | 2020-10-29 11:20:34 +0800 | [diff] [blame] | 326 | #ifdef SEL_LOGGER_MONITOR_WATCHDOG_EVENTS |
Patrick Williams | ccef227 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 327 | sdbusplus::bus::match_t watchdogEventMonitor = |
Charles Hsu | dbd77b9 | 2020-10-29 11:20:34 +0800 | [diff] [blame] | 328 | startWatchdogEventMonitor(conn); |
| 329 | #endif |
George Hung | 486e42e | 2021-04-14 20:20:42 +0800 | [diff] [blame] | 330 | |
| 331 | #ifdef SEL_LOGGER_MONITOR_THRESHOLD_ALARM_EVENTS |
| 332 | startThresholdAlarmMonitor(conn); |
| 333 | #endif |
JinFuLin | 7c2810b | 2022-12-02 13:55:28 +0800 | [diff] [blame] | 334 | |
| 335 | #ifdef SEL_LOGGER_MONITOR_HOST_ERROR_EVENTS |
| 336 | startHostErrorEventMonitor(conn); |
| 337 | #endif |
Jason M. Bills | 5e049d3 | 2018-10-19 12:59:38 -0700 | [diff] [blame] | 338 | io.run(); |
| 339 | |
| 340 | return 0; |
| 341 | } |