From f8716aa3442308c1bd81361ad11621ffc784096a Mon Sep 17 00:00:00 2001 From: fperez Date: Thu, 2 Nov 2023 12:57:32 -0300 Subject: [PATCH] Add "proposed_repair_action" attr to event log file Even when event logs have this attribute available, it is not being logged in the /var/log/fm-event.log file. This could result in a lack of certain information for external tools that use it. Test Plan: PASS: Build fm-common package and install it. Then, trigger an alarm with 'proposed_repair_action'. Verify its presence in the /var/log/fm-event.log PASS: Raise an alarm without 'proposed_repair_action'. Check that the empty attribute is present. PASS: Raise an alarm with a long 'proposed_repair_action'. verify that this message is not affecting other attributes. Closes-Bug: 2042579 Change-Id: Ic27b840041872c3afd0be28e11556acf42a3d5a9 Signed-off-by: fperez --- fm-common/sources/fmLog.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fm-common/sources/fmLog.cpp b/fm-common/sources/fmLog.cpp index eea08533..1fc93351 100644 --- a/fm-common/sources/fmLog.cpp +++ b/fm-common/sources/fmLog.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2014-2018 Wind River Systems, Inc. +// Copyright (c) 2014-2018, 2023 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -65,6 +65,9 @@ static char * formattedEvent(CFmDbEventLog::data_type event_map, char * output, outputLen = strlen(output); snprintf(output + outputLen, outputSize - outputLen, "\"%s\" : \"%s\", ", "state", escape_json(event_map["state"].c_str(), buffer, bufLen)); + outputLen = strlen(output); + snprintf(output + outputLen, outputSize - outputLen, "\"%s\" : \"%s\", ", "proposed_repair_action", escape_json(event_map["proposed_repair_action"].c_str(), buffer, bufLen)); + outputLen = strlen(output); snprintf(output + outputLen, outputSize - outputLen, "\"%s\" : \"%s\" }", "timestamp", escape_json(event_map["timestamp"].c_str(), buffer, bufLen));