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 <fabrizio.perez@windriver.com>
This commit is contained in:
fperez 2023-11-02 12:57:32 -03:00 committed by Fabrizio Perez
parent 8bd6e5b92d
commit f8716aa344
1 changed files with 4 additions and 1 deletions

View File

@ -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));