summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2019-08-02 00:41:39 +0300
committerEd Tanous <ed.tanous@intel.com>2019-08-09 01:48:58 +0300
commitaf07e3f5f3da3d30d17d79904ad185167e7a6821 (patch)
tree9f75651754430875c0c43614bd0d282c627dd600
parentec8faf9243b6f6320daeb3ba6a94d1f257034506 (diff)
downloadbmcweb-af07e3f5f3da3d30d17d79904ad185167e7a6821.tar.xz
Fix getting individual journal entries with an underscore
The journal entries with an underscore in the ID could not be accessed individually. This change tracks the unique ID while searching for the entry so it can find the correct entry with an underscore. Tested: Checked that individual journal entries with and without an underscore can be accessed. Passed the Redfish Service Validator. Change-Id: I4aedbe1cb7d5f3cb896c5a0e766e9a274f0ee076 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
-rw-r--r--redfish-core/lib/log_services.hpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index a9356ae66f..578e673a16 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1435,14 +1435,25 @@ class BMCJournalLogEntry : public Node
journalTmp, sd_journal_close);
journalTmp = nullptr;
// Go to the timestamp in the log and move to the entry at the index
+ // tracking the unique ID
+ std::string idStr;
+ bool firstEntry = true;
ret = sd_journal_seek_realtime_usec(journal.get(), ts);
for (int i = 0; i <= index; i++)
{
sd_journal_next(journal.get());
+ if (!getUniqueEntryID(journal.get(), idStr, firstEntry))
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ if (firstEntry)
+ {
+ firstEntry = false;
+ }
}
// Confirm that the entry ID matches what was requested
- std::string idStr;
- if (!getUniqueEntryID(journal.get(), idStr) || idStr != entryID)
+ if (idStr != entryID)
{
messages::resourceMissingAtURI(asyncResp->res, entryID);
return;