diff options
author | Ed Tanous <edtanous@google.com> | 2023-06-28 18:33:29 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-06-30 18:40:43 +0300 |
commit | c05bba459941ae17aa9508529ccd0284e5300213 (patch) | |
tree | 85152ba94e7372018abfbe819c26dd68e607934a /redfish-core/lib | |
parent | 1017ef80f690e1d4c0a7c9799a9a3e26551308df (diff) | |
download | bmcweb-c05bba459941ae17aa9508529ccd0284e5300213.tar.xz |
Fix a bug for zero arg EventLog entries
When the EventLog is pushed to the files, there is a case where we can't
know the difference between a message with zero args, and a message with
one arg, where the first arg is empty string. They both show up in the
log similar to
<DATE> OpenBMC.MessageId,
This causes Redfish to return a LogEntry with one empty argument.
This commit uses the registry information to resize the args array
appropriately, dependent on what message is being sent, effectively
ignoring what the developer put into their logs. If there's too many
args, they're removed, if there's not enough args, empty args are added.
Tested:
GET /redfish/v1/Systems/system/LogServices/EventLog/Entries
Returned an entry with the properties:
"Message": "Power restore policy applied.",
"MessageArgs": [],
"MessageId": "OpenBMC.0.1.PowerRestorePolicyApplied",
Which appear to be correct.
Change-Id: I7d6f150bddad88d1c3da9d0424268d1eac902145
Signed-off-by: Ed Tanous <edtanous@google.com>
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/log_services.hpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 678ab43eaf..72930cc79f 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -1315,6 +1315,8 @@ static LogParseError std::vector<std::string_view> messageArgs(logEntryIter, logEntryFields.end()); + messageArgs.resize(message->numberOfArgs); + std::string msg = redfish::registries::fillMessageArgs(messageArgs, message->message); if (msg.empty()) |