Skip to content

Commit

Permalink
Don't add empty lines to Fluent-bit config
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek committed Jan 12, 2021
1 parent 4229c55 commit b21906d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
43 changes: 22 additions & 21 deletions deploy/helm/sumologic/upgrade-2.0.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -866,27 +866,28 @@ function migrate_fluent_bit() {
else
# Trim whitespace
line="${line##+([[:space:]])}"

case "${SECTION}" in
"INPUT")
INPUTS="$(printf "%s\n %s" "${INPUTS}" "${line}")"
;;

"OUTPUT")
OUTPUTS="$(printf "%s\n %s" "${OUTPUTS}" "${line}")"
;;

"PARSER")
PARSERS="$(printf "%s\n %s" "${PARSERS}" "${line}")"
;;

"FILTER")
FILTERS="$(printf "%s\n %s" "${FILTERS}" "${line}")"
;;

*)
;;
esac
if [[ -n "${line}" ]]; then
case "${SECTION}" in
"INPUT")
INPUTS="$(printf "%s\n %s" "${INPUTS}" "${line}")"
;;

"OUTPUT")
OUTPUTS="$(printf "%s\n %s" "${OUTPUTS}" "${line}")"
;;

"PARSER")
PARSERS="$(printf "%s\n %s" "${PARSERS}" "${line}")"
;;

"FILTER")
FILTERS="$(printf "%s\n %s" "${FILTERS}" "${line}")"
;;

*)
;;
esac
fi
fi
done < <(echo "${RAWCONFIG}")

Expand Down
5 changes: 5 additions & 0 deletions tests/upgrade_v2_script/static/fluent_bit.input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ fluent-bit:
timeFormat: "%Y-%m-%dT%H:%M:%S.%L%z"
rawConfig: |-
@INCLUDE fluent-bit-service.conf
[INPUT]
Name tail
Path /var/log/containers/*.log
Expand All @@ -65,10 +66,13 @@ fluent-bit:
Skip_Long_Lines On
DB /tail-db/tail-containers-state-sumo.db
DB.Sync Normal
[OUTPUT]
Name test-output-1
[FILTER]
Name test-filter-1
[PARSER]
Name test-logfmt-parser-1
Format logfmt
Expand Down Expand Up @@ -130,4 +134,5 @@ fluent-bit:
Systemd_Filter _SYSTEMD_UNIT=var-lib-etcd2.service
Max_Entries 1000
Read_From_Tail true
@INCLUDE fluent-bit-output.conf

0 comments on commit b21906d

Please sign in to comment.