mirror of
https://github.com/clearlinux/cloud-native-setup.git
synced 2026-09-01 19:31:46 +00:00
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>
This commit is contained in:
committed by
David Lyle
parent
18fde35232
commit
be164144e4
@@ -111,7 +111,7 @@ EOF
|
||||
# If we have a JSON URL or host/socket pair set up, post the results there as well.
|
||||
# Optionally compress into a single line.
|
||||
if [[ $JSON_TX_ONELINE ]]; then
|
||||
json="$(sed 's/[\n\t]//g' <<< ${json})"
|
||||
json=$(tr -d '\t\n\r\f' <<< ${json})
|
||||
fi
|
||||
|
||||
if [[ $JSON_HOST ]]; then
|
||||
|
||||
Reference in New Issue
Block a user