Return JSON instead of base64 for EventLog entry attachment download
After this change [1] log entry attachment returns a JSON
instead of a binary blob, it is no longer required to be
base-64 encoded. Return the JSON as-is and modify the
response header to reflect the new format.
Tested:
- Unit tests pass
- Built an image with my code, ran it in QEMU:
1. Injected a log entry with command: [2].
2. Verified LogEntry data [3].
3. Verified Attachment returns JSON data which is no longer base-64
encoded with expected header [4].
4. Verified Attachment returns 400 with octet-stream header which was
previously accepted [5].
[1] https://gerrit.openbmc.org/c/openbmc/phosphor-logging/+/89777
[2] Command to inject a log entry and its output:
```
log-create xyz.openbmc_project.Sensor.Threshold.ReadingAboveUpperCriticalThreshold --json '{ "SENSOR_NAME": "TEST_SENSOR", "READING_VALUE": 99.5, "UNITS": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", "THRESHOLD_VALUE": 8.0 }'
<3> OPENBMC_MESSAGE_ID={"severity":2,"xyz.openbmc_project.Sensor.Threshold.ReadingAboveUpperCriticalThreshold":{"READING_VALUE":99.5,"SENSOR_NAME":"TEST_SENSOR","THRESHOLD_VALUE":8.0,"UNITS":"xyz.openbmc_project.Sensor.Value.Unit.DegreesC","_SOURCE":{"COLUMN":45,"FILE":"/usr/src/debug/phosphor-logging/1.0+git/log_create_main.cpp","FUNCTION":"int generate_event(const std::string&, const nlohmann::json_abi_v3_12_0::json&, std::optional<int>)","LINE":35,"PID":9445}}}
/xyz/openbmc_project/logging/entry/40
```
[3] Logservices request and output
```
curl -ks -u root:0penBmc -H "Content-Type: application/json" https://${bmc}/localhost/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40
{
"@odata.id": "/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40",
"@odata.type": "#LogEntry.v1_9_0.LogEntry",
"AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40/attachment",
"Created": "2026-06-23T09:45:05.600-07:00",
"EntryType": "Event",
"Id": "40",
"Message": "Sensor 'TEST_SENSOR' reading of 99.5 (xyz.openbmc_project.Sensor.Value.Unit.DegreesC) is above the 8.0 upper critical threshold.",
"MessageArgs": [
"TEST_SENSOR",
"99.5",
"xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
"8.0"
],
"MessageId": "SensorEvent.1.0.ReadingAboveUpperCriticalThreshold",
"Modified": "2026-06-23T09:45:05.600-07:00",
"Name": "Manager Event Log Entry",
"Resolution": "Check the condition of the resources listed in RelatedItem.",
"Resolved": false,
"Severity": "Critical"
}
```
[4] LogEntry Attachment
```
curl -ks -u root:0penBmc -H "Accept: application/json" -D - https://localhost/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40/attachment
HTTP/1.1 200 OK
Allow: GET
OData-Version: 4.0
Content-Type: application/json
Strict-Transport-Security: max-age=31536000; includeSubdomains
Pragma: no-cache
Cache-Control: no-store, max-age=0
X-Content-Type-Options: nosniff
Date: Tue, 23 Jun 2026 18:07:51 GMT
Content-Length: 814
{
"additionalData": {
"READING_VALUE": "99.5",
"SENSOR_NAME": "TEST_SENSOR",
"THRESHOLD_VALUE": "8.0",
"UNITS": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
"_CODE_FILE": "/usr/src/debug/phosphor-logging/1.0+git/log_create_main.cpp",
"_CODE_FUNC": "int generate_event(const std::string&, const nlohmann::json_abi_v3_12_0::json&, std::optional<int>)",
"_CODE_LINE": "35",
"_PID": "9445"
},
"associations": [],
"eventId": "",
"id": 40,
"jsonVersion": 1,
"message": "xyz.openbmc_project.Sensor.Threshold.ReadingAboveUpperCriticalThreshold",
"resolution": "",
"resolved": false,
"severity": 2,
"timestamp": 1782233105600,
"updateTimestamp": 1782233105600,
"version": "catalina-47de2434c3a-dirty"
}
```
[5] Verify that the octet-stream header is rejected
```curl -ks -u root:0penBmc -H "Accept: application/octet-stream" -D - https://localhost/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40/attachment
HTTP/1.1 400 Bad Request
Allow: GET
OData-Version: 4.0
Content-Type: application/json
Strict-Transport-Security: max-age=31536000; includeSubdomains
Pragma: no-cache
Cache-Control: no-store, max-age=0
X-Content-Type-Options: nosniff
Date: Tue, 23 Jun 2026 17:03:06 GMT
Content-Length: 814
{
"additionalData": {
"READING_VALUE": "99.5",
"SENSOR_NAME": "TEST_SENSOR",
"THRESHOLD_VALUE": "8.0",
"UNITS": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
"_CODE_FILE": "/usr/src/debug/phosphor-logging/1.0+git/log_create_main.cpp",
"_CODE_FUNC": "int generate_event(const std::string&, const nlohmann::json_abi_v3_12_0::json&, std::optional<int>)",
"_CODE_LINE": "35",
"_PID": "9445"
},
"associations": [],
"eventId": "",
"id": 40,
"jsonVersion": 1,
"message": "xyz.openbmc_project.Sensor.Threshold.ReadingAboveUpperCriticalThreshold",
"resolution": "",
"resolved": false,
"severity": 2,
"timestamp": 1782233105600,
"updateTimestamp": 1782233105600,
"version": "catalina-47de2434c3a-dirty"
}
```
Change-Id: Ic6019b80ca6ea32783ae2ffe711adeb5ef2eb157
Signed-off-by: Archit Mehrotra <architmehrotra@meta.com> A
Archit Mehrotra committed
bd5f6cf50d822878ac4bb9bfaeee181d436df371
Parent: 61c6ec1
Committed by Ed Tanous <ed@tanous.net>
on 7/22/2026, 6:29:11 PM