diff --git a/bitnami/logstash/7/ol-7/Dockerfile b/bitnami/logstash/7/ol-7/Dockerfile index e265b0556126..71d50560a24d 100644 --- a/bitnami/logstash/7/ol-7/Dockerfile +++ b/bitnami/logstash/7/ol-7/Dockerfile @@ -9,7 +9,7 @@ ENV HOME="/" \ COPY prebuildfs / # Install required system packages and dependencies RUN install_packages ca-certificates curl glibc gzip hostname libaio-devel libgcc procps-ng sudo tar which zlib -RUN . ./libcomponent.sh && component_unpack "logstash" "7.5.2-0" --checksum 028cd9c6c30aefbfabf4bd3d10de0a200f7bd39fcc6f034a8fef83607b96b9ea +RUN . ./libcomponent.sh && component_unpack "logstash" "7.5.2-1" --checksum 4bbadedda71fde025f397b337aa291f703759e0ab878fee505841f03c1a49fa4 RUN . ./libcomponent.sh && component_unpack "java" "1.8.242-0" --checksum 974f750091ac1bf18cc1ce9472ef5ed7c1b328a2c17471cb9ac810fcded67151 RUN yum upgrade -y && \ rm -r /var/cache/yum @@ -18,7 +18,7 @@ RUN /build/install-gosu.sh COPY rootfs / RUN /postunpack.sh ENV BITNAMI_APP_NAME="logstash" \ - BITNAMI_IMAGE_VERSION="7.5.2-ol-7-r11" \ + BITNAMI_IMAGE_VERSION="7.5.2-ol-7-r12" \ PATH="/opt/bitnami/logstash/bin:/opt/bitnami/java/bin:$PATH" EXPOSE 8080 diff --git a/bitnami/logstash/7/ol-7/prebuildfs/libfile.sh b/bitnami/logstash/7/ol-7/prebuildfs/libfile.sh index 12010f043e49..337e2e779701 100644 --- a/bitnami/logstash/7/ol-7/prebuildfs/libfile.sh +++ b/bitnami/logstash/7/ol-7/prebuildfs/libfile.sh @@ -5,18 +5,56 @@ # Functions ######################## -# Ensure a line exists in the file by replacing a matching line. +# Replace a regex in a file # Arguments: # $1 - filename -# $2 - line -# $3 - match +# $2 - match regex +# $3 - substitute regex +# $4 - use POSIX regex. Default: true # Returns: # None ######################### -file_contains_line() { +replace_in_file() { local filename="${1:?filename is required}" - local line="${2:?line is required}" - local match="${3:?match is required}" + local match_regex="${2:?match regex is required}" + local substitute_regex="${3:?substitute regex is required}" + local posix_regex=${4:-true} - sed --in-place "s/^$match\$/$line/" "$filename" + local result + + # We should avoid using 'sed in-place' substitutions + # 1) They are not compatible with files mounted from ConfigMap(s) + # 2) We found incompatibility issues with Debian10 and "in-place" substitutions + if [[ $posix_regex = true ]]; then + result="$(sed -E "s@$match_regex@$substitute_regex@g" "$filename")" + else + result="$(sed "s@$match_regex@$substitute_regex@g" "$filename")" + fi + echo "$result" > "$filename" +} + +######################## +# Remove a line in a file based on a regex +# Arguments: +# $1 - filename +# $2 - match regex +# $3 - use POSIX regex. Default: true +# Returns: +# None +######################### +remove_in_file() { + local filename="${1:?filename is required}" + local match_regex="${2:?match regex is required}" + local posix_regex=${3:-true} + local result + + # We should avoid using 'sed in-place' substitutions + # 1) They are not compatible with files mounted from ConfigMap(s) + # 2) We found incompatibility issues with Debian10 and "in-place" substitutions + if [[ $posix_regex = true ]]; then + result="$(sed -E "/$match_regex/d" "$filename")" + else + result="$(sed "/$match_regex/d" "$filename")" + fi + echo "$result" > "$filename" } diff --git a/bitnami/logstash/README.md b/bitnami/logstash/README.md index 4ad22247d4b2..001bc49862e1 100644 --- a/bitnami/logstash/README.md +++ b/bitnami/logstash/README.md @@ -44,7 +44,7 @@ Non-root container images add an extra layer of security and are generally recom Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/). -* [`7-ol-7`, `7.5.2-ol-7-r11` (7/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-logstash/blob/7.5.2-ol-7-r11/7/ol-7/Dockerfile) +* [`7-ol-7`, `7.5.2-ol-7-r12` (7/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-logstash/blob/7.5.2-ol-7-r12/7/ol-7/Dockerfile) * [`7-debian-10`, `7.5.2-debian-10-r9`, `7`, `7.5.2`, `latest` (7/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-logstash/blob/7.5.2-debian-10-r9/7/debian-10/Dockerfile) Subscribe to project updates by watching the [bitnami/logstash GitHub repo](https://github.com/bitnami/bitnami-docker-logstash).