From de5c1f5fc89dd7c751c347d388e8e68d14997220 Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Thu, 1 Dec 2022 09:15:33 +0100 Subject: [PATCH] debugd: build logstash image from fedora37 Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --- .../debugd/logcollector/logstash/Dockerfile | 17 ++++++++++++++--- .../logstash/config/log4j2.properties | 16 ++++++++++++++++ .../logcollector/logstash/config/pipelines.yml | 6 ++++++ 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 debugd/internal/debugd/logcollector/logstash/config/log4j2.properties create mode 100644 debugd/internal/debugd/logcollector/logstash/config/pipelines.yml diff --git a/debugd/internal/debugd/logcollector/logstash/Dockerfile b/debugd/internal/debugd/logcollector/logstash/Dockerfile index a2337bb49..defae778a 100644 --- a/debugd/internal/debugd/logcollector/logstash/Dockerfile +++ b/debugd/internal/debugd/logcollector/logstash/Dockerfile @@ -1,9 +1,20 @@ -FROM docker.io/opensearchproject/logstash-oss-with-opensearch-output-plugin:7.16.2 AS release +FROM fedora:37@sha256:f2c083c0b7d2367a375f15e002c2dc7baaca2b3181ace61f9d5113a8fe2f6b44 AS build -RUN rm -f /usr/share/logstash/pipeline/logstash.conf +ARG LOGSTASH_VER=8.4.0 + +RUN curl -sLO https://artifacts.opensearch.org/logstash/logstash-oss-with-opensearch-output-plugin-$LOGSTASH_VER-linux-x64.tar.gz +RUN tar -zxvf logstash-oss-with-opensearch-output-plugin-$LOGSTASH_VER-linux-x64.tar.gz + +FROM fedora:37@sha256:f2c083c0b7d2367a375f15e002c2dc7baaca2b3181ace61f9d5113a8fe2f6b44 AS release + +COPY --from=build logstash-* /usr/share/logstash COPY debugd/internal/debugd/logcollector/logstash/config/ /usr/share/logstash/config/ - COPY debugd/internal/debugd/logcollector/logstash/templates/ /usr/share/constellogs/templates/ +RUN chmod -R 777 /usr/share/logstash/data/ + +RUN useradd -s /bin/bash logstash +USER logstash + ENTRYPOINT ["/usr/share/logstash/bin/logstash"] diff --git a/debugd/internal/debugd/logcollector/logstash/config/log4j2.properties b/debugd/internal/debugd/logcollector/logstash/config/log4j2.properties new file mode 100644 index 000000000..663a01580 --- /dev/null +++ b/debugd/internal/debugd/logcollector/logstash/config/log4j2.properties @@ -0,0 +1,16 @@ +status = error +name = LogstashPropertiesConfig + +appender.console.type = Console +appender.console.name = plain_console +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c]%notEmpty{[%X{pipeline.id}]}%notEmpty{[%X{plugin.id}]} %m%n + +appender.json_console.type = Console +appender.json_console.name = json_console +appender.json_console.layout.type = JSONLayout +appender.json_console.layout.compact = true +appender.json_console.layout.eventEol = true + +rootLogger.level = ${sys:ls.log.level} +rootLogger.appenderRef.console.ref = ${sys:ls.log.format}_console diff --git a/debugd/internal/debugd/logcollector/logstash/config/pipelines.yml b/debugd/internal/debugd/logcollector/logstash/config/pipelines.yml new file mode 100644 index 000000000..aed22ce73 --- /dev/null +++ b/debugd/internal/debugd/logcollector/logstash/config/pipelines.yml @@ -0,0 +1,6 @@ +# This file is where you define your pipelines. You can define multiple. +# For more information on multiple pipelines, see the documentation: +# https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html + +- pipeline.id: main + path.config: "/usr/share/logstash/pipeline"