[bitnami/logstash] Release 8.5.0-debian-11-r2 (#12847)

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Bitnami Bot 2022-11-07 21:08:47 +01:00 committed by GitHub
parent 8952b155cc
commit e5e5c99433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 2 deletions

View File

@ -1,11 +1,12 @@
FROM docker.io/bitnami/minideb:bullseye
ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security"
ARG LOGSTASH_PLUGINS
ARG TARGETARCH
LABEL org.opencontainers.image.authors="https://bitnami.com/contact" \
org.opencontainers.image.description="Application packaged by Bitnami" \
org.opencontainers.image.ref.name="8.5.0-debian-11-r1" \
org.opencontainers.image.ref.name="8.5.0-debian-11-r2" \
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/logstash" \
org.opencontainers.image.title="logstash" \
org.opencontainers.image.vendor="VMware, Inc." \

View File

@ -349,3 +349,30 @@ logstash_stop() {
debug "Stopping Logstash"
stop_service_using_pid "$LOGSTASH_PID_FILE"
}
########################
# Install Logstash plugins
# Globals:
# LOGSTASH_*
# Arguments:
# None
# Returns:
# None
#########################
logstash_install_plugins() {
read -r -a plugins_list <<<"$(tr ',;' ' ' <<<"$LOGSTASH_PLUGINS")"
# Skip if there isn't any plugin to install
[[ -z "${plugins_list[*]:-}" ]] && return
# Install plugins
info "Installing plugins: ${plugins_list[*]}"
for plugin in "${plugins_list[@]}"; do
debug "Installing plugin: ${plugin}"
if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then
logstash-plugin install "$plugin"
else
logstash-plugin install "$plugin" >/dev/null 2>&1
fi
done
}

View File

@ -27,6 +27,7 @@ logstash_env_vars=(
LOGSTASH_EXPOSE_API
LOGSTASH_API_PORT_NUMBER
LOGSTASH_PIPELINE_CONF_STRING
LOGSTASH_PLUGINS
LOGSTASH_EXTRA_FLAGS
LOGSTASH_HEAP_SIZE
LOGSTASH_MAX_ALLOWED_MEMORY_PERCENTAGE
@ -88,6 +89,7 @@ export LOGSTASH_EXPOSE_API="${LOGSTASH_EXPOSE_API:-no}"
export LOGSTASH_API_PORT_NUMBER="${LOGSTASH_API_PORT_NUMBER:-9600}"
LOGSTASH_PIPELINE_CONF_STRING="${LOGSTASH_PIPELINE_CONF_STRING:-"${LOGSTASH_CONF_STRING:-}"}"
export LOGSTASH_PIPELINE_CONF_STRING="${LOGSTASH_PIPELINE_CONF_STRING:-}"
export LOGSTASH_PLUGINS="${LOGSTASH_PLUGINS:-}"
LOGSTASH_EXTRA_FLAGS="${LOGSTASH_EXTRA_FLAGS:-"${LOGSTASH_EXTRA_ARGS:-}"}"
export LOGSTASH_EXTRA_FLAGS="${LOGSTASH_EXTRA_FLAGS:-}"
export LOGSTASH_HEAP_SIZE="${LOGSTASH_HEAP_SIZE:-1024m}"

View File

@ -17,11 +17,15 @@ set -o pipefail
info "Creating Logstash daemon user"
ensure_user_exists "$LOGSTASH_DAEMON_USER" --group "$LOGSTASH_DAEMON_GROUP"
for dir in "$LOGSTASH_CONF_DIR" "$LOGSTASH_PIPELINE_CONF_DIR" "$LOGSTASH_MOUNTED_CONF_DIR" "$LOGSTASH_MOUNTED_PIPELINE_CONF_DIR" "$LOGSTASH_VOLUME_DIR" "$LOGSTASH_DATA_DIR"; do
for dir in "$LOGSTASH_BASE_DIR/vendor/bundle/jruby" "$LOGSTASH_CONF_DIR" "$LOGSTASH_PIPELINE_CONF_DIR" "$LOGSTASH_MOUNTED_CONF_DIR" "$LOGSTASH_MOUNTED_PIPELINE_CONF_DIR" "$LOGSTASH_VOLUME_DIR" "$LOGSTASH_DATA_DIR"; do
ensure_dir_exists "$dir"
configure_permissions_ownership "$dir" -d "775" -f "664" -u "$LOGSTASH_DAEMON_USER" -g "root"
done
for file in "$LOGSTASH_BASE_DIR/Gemfile" "$LOGSTASH_BASE_DIR/Gemfile.lock"; do
configure_permissions_ownership "$file" -f "664" -u "$LOGSTASH_DAEMON_USER" -g "root"
done
info "Configuring paths"
logstash_yml_set "$LOGSTASH_CONF_FILE" '"path.data"' "$LOGSTASH_DATA_DIR"
@ -46,3 +50,5 @@ appender.json_console.layout.eventEol = true
rootLogger.level = \${sys:ls.log.level}
rootLogger.appenderRef.console.ref = \${sys:ls.log.format}_console
EOF
logstash_install_plugins

View File

@ -21,3 +21,5 @@ am_i_root && ensure_user_exists "$LOGSTASH_DAEMON_USER" --group "$LOGSTASH_DAEMO
# Ensure Logstash is initialized
logstash_initialize
# Install Logstash plugins
logstash_install_plugins

View File

@ -170,6 +170,28 @@ You can expose the Logstash API by setting the environment variable `LOGSTASH_EX
$ docker run -d --env LOGSTASH_EXPOSE_API=yes --env LOGSTASH_API_PORT_NUMBER=9090 -p 9090:9090 bitnami/logstash:latest
```
### Plugins
You can add extra plugins by setting the `LOGSTASH_PLUGINS` environment variable. To specify multiple plugins, separate them by spaces, commas or semicolons. When the container is initialized it will install all of the specified plugins before starting Logstash.
```console
$ docker run -d --name logstash \
-e LOGSTASH_PLUGINS=logstash-input-github \
bitnami/logstash:latest
```
#### Adding plugins at build time (persisting plugins)
The Bitnami Logstash image provides a way to create your custom image installing plugins on build time. This is the preferred way to persist plugins when using Logstash, as they will not be installed every time the container is started but just once at build time.
To create your own image providing plugins execute the flowing command:
```console
$ docker build --build-arg LOGSTASH_PLUGINS=<plugin1,plugin2,...> -t bitnami/logstash:latest 'https://github.com/bitnami/containers/blob/main/bitnami/logstash.git#master:8/debian-11'
```
The command above will build the image providing this GitHub repository as build context, and will pass the list of plugins to install to the build logic.
## Logging
The Bitnami Logstash Docker image sends the container logs to `stdout`. To view the logs: