Skip to content

Commit be16414

Browse files
Graham Whaleydklyle
Graham Whaley
authored andcommitted
metrics: json: use tr for newline/whitespace conversion
Use `tr` rather than `sed` for doing the line/whitespace conversions on the JSON stream, if asked. Slightly more efficient, and we also drop the wrapping ""'s, to allow the data to land in logstash without error. Signed-off-by: Graham Whaley <graham.whaley@intel.com>
1 parent 18fde35 commit be16414

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

metrics/lib/json.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ EOF
111111
# If we have a JSON URL or host/socket pair set up, post the results there as well.
112112
# Optionally compress into a single line.
113113
if [[ $JSON_TX_ONELINE ]]; then
114-
json="$(sed 's/[\n\t]//g' <<< ${json})"
114+
json=$(tr -d '\t\n\r\f' <<< ${json})
115115
fi
116116

117117
if [[ $JSON_HOST ]]; then

0 commit comments

Comments
 (0)