From c3511209f9ecd05d6f57bd4493c9c00da39af938 Mon Sep 17 00:00:00 2001 From: Razvan Stoica Date: Tue, 9 Mar 2021 13:35:40 +0200 Subject: [PATCH] Add support for logging remediation measures in JSON format --- output_lib.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/output_lib.sh b/output_lib.sh index 384dfe0..efef321 100644 --- a/output_lib.sh +++ b/output_lib.sh @@ -93,4 +93,12 @@ resulttestjson() { itemsJson=$(printf "["; ISEP=""; ITEMCOUNT=0; for item in $truncItems; do printf "%s\"%s\"" "$ISEP" "$item"; ISEP=","; done; printf "]") printf "\"result\": \"%s\", \"details\": \"%s: %s\", \"items\": %s}" "$1" "$2" "$truncItems" "$itemsJson" | tee -a "$logger.json" 2>/dev/null 1>&2 fi + # Log remediation measure + if [ ! -z "$remediation" ]; then + printf ", \"remediation\": \"%s\"" "$remediation" | tee -a "$logger.json" 2>/dev/null 1>&2 + if [ ! -z "$remediationImpact" ]; then + printf ", \"remediation-impact\": \"%s\"" "$remediationImpact" | tee -a "$logger.json" 2>/dev/null 1>&2 + fi + fi + printf "}" | tee -a "$logger.json" 2>/dev/null 1>&2 }