monitor: add journal entries to fan PELs
Adds a new JSON section to the PEL that contains the last 25 systemd
journal entries indicating which system services have
started/stopped/etc.
Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Change-Id: I9f8a7ab8bb7c213cde30496327d83e9f3fab7c94
diff --git a/monitor/fan_error.hpp b/monitor/fan_error.hpp
index 79573e1..1f36c2f 100644
--- a/monitor/fan_error.hpp
+++ b/monitor/fan_error.hpp
@@ -138,6 +138,35 @@
private:
/**
+ * @brief returns a JSON structure containing the previous N journal
+ * entries.
+ *
+ * @param[in] numLines - Number of lines of journal to retrieve
+ */
+ nlohmann::json getJournalEntries(int numLines) const;
+
+ /**
+ * Gets the realtime (wallclock) timestamp for the current journal entry.
+ *
+ * @param journal current journal entry
+ * @return timestamp as a date/time string
+ */
+ std::string getTimeStamp(sd_journal* journal) const;
+
+ /**
+ * Gets the value of the specified field for the current journal entry.
+ *
+ * Returns an empty string if the current journal entry does not have the
+ * specified field.
+ *
+ * @param journal current journal entry
+ * @param field journal field name
+ * @return field value
+ */
+ std::string getFieldValue(sd_journal* journal,
+ const std::string& field) const;
+
+ /**
* @brief Returns an FFDCFile holding the Logger contents
*
* @return std::unique_ptr<FFDCFile> - The file object