diff --git a/deploy/helm/sumologic/upgrade-2.0.0.sh b/deploy/helm/sumologic/upgrade-2.0.0.sh index 4deb48acc3..7e908d8c5a 100755 --- a/deploy/helm/sumologic/upgrade-2.0.0.sh +++ b/deploy/helm/sumologic/upgrade-2.0.0.sh @@ -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}") diff --git a/tests/upgrade_v2_script/static/fluent_bit.input.yaml b/tests/upgrade_v2_script/static/fluent_bit.input.yaml index 2c85924236..7f24489dcd 100644 --- a/tests/upgrade_v2_script/static/fluent_bit.input.yaml +++ b/tests/upgrade_v2_script/static/fluent_bit.input.yaml @@ -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 @@ -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 @@ -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