diff --git a/README.md b/README.md index 2b7ab89..baa5ac3 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,9 @@ For Splunk as the observability platform, execute these commands to setup the do docker run -it --name jfrog-fluentd-splunk-rt -v $JFROG_HOME/artifactory/var/:/var/opt/jfrog/artifactory --env-file docker.env jfrog/fluentd-splunk-rt ``` +> [!IMPORTANT] +> The fluentd image runs as a non-root user (`fluent`, uid `999`). The container tails the Artifactory log files from the mounted directory and writes `.pos` (position) files next to them, so uid `999` must be able to **read** the mounted log files and **write** into the mounted log directory. JFrog product logs are typically owned by the product user (for example uid `1030`, directory mode `755`, files mode `640`), which uid `999` cannot access by default - fluentd then fails with `Errno::EACCES ... .pos` and the worker restarts in a loop. To avoid this, either run the container as root (`docker run --user root ...`), run it as the uid that owns the Artifactory logs (`--user `), or make the mounted log directory readable and writable by uid `999`. + ### Kubernetes Deployment with Helm Recommended installation for Kubernetes is to utilize the helm chart with the associated values.yaml in this repo. diff --git a/docker-build/Dockerfile b/docker-build/Dockerfile index f57990c..0b2c604 100644 --- a/docker-build/Dockerfile +++ b/docker-build/Dockerfile @@ -1,5 +1,5 @@ -# Dockerfile for bitnami/fluentd sidecar image with all the necessary plugins for our log analytic providers -FROM bitnami/fluentd:1.18.0 +# Dockerfile for fluentd sidecar image with all the necessary plugins for our log analytic providers +FROM reg.echohq.com/fluentd:1.19.2 LABEL maintainer="Partner Engineering " ## Build time Arguments, short circuit them to ENV Variables so they are available at run time also @@ -13,23 +13,22 @@ ENV TGT_PLATFORM=$TARGET USER root -## Install JFrog Plugins -RUN fluent-gem install fluent-plugin-concat -RUN fluent-gem install fluent-plugin-splunk-hec -RUN fluent-gem install fluent-plugin-jfrog-siem -RUN fluent-gem install fluent-plugin-jfrog-metrics -RUN fluent-gem install fluent-plugin-jfrog-send-metrics - # Install prerequisites -RUN apt-get update && apt-get install -y curl -CMD /bin/bash +RUN apt-get update && \ + apt-get install -y --no-install-recommends curl && \ + rm -rf /var/lib/apt/lists/* -## Download Config Files -RUN if [ "$SRC_PLATFORM" = "JFRT" ] ; then echo "Downloading the fluentd config file for $SRC_PLATFORM and $TGT_PLATFORM "; curl https://raw.githubusercontent.com/jfrog/log-analytics-splunk/master/fluent.conf.rt -o /opt/bitnami/fluentd/conf/fluentd.conf; else echo "Not Downloading"; fi -RUN if [ "$SRC_PLATFORM" = "JFXRAY" ] ; then echo "Downloading the fluentd config file for $SRC_PLATFORM and $TGT_PLATFORM "; curl https://raw.githubusercontent.com/jfrog/log-analytics-splunk/master/fluent.conf.xray -o /opt/bitnami/fluentd/conf/fluentd.conf; else echo "Not Downloading"; fi +## Install JFrog Plugins +RUN fluent-gem install fluent-plugin-concat && \ + fluent-gem install fluent-plugin-splunk-hec && \ + fluent-gem install fluent-plugin-jfrog-siem && \ + fluent-gem install fluent-plugin-jfrog-metrics && \ + fluent-gem install fluent-plugin-jfrog-send-metrics -ENTRYPOINT if [ "$TGT_PLATFORM" = "SPLUNK" ] ; then cat /opt/bitnami/fluentd/conf/fluentd.conf; fluentd -v -c /opt/bitnami/fluentd/conf/fluentd.conf; fi +## Download Config Files +RUN if [ "$SRC_PLATFORM" = "JFRT" ] ; then curl -fsSL https://raw.githubusercontent.com/jfrog/log-analytics-splunk/master/fluent.conf.rt -o /fluentd/etc/fluent.conf; fi +RUN if [ "$SRC_PLATFORM" = "JFXRAY" ] ; then curl -fsSL https://raw.githubusercontent.com/jfrog/log-analytics-splunk/master/fluent.conf.xray -o /fluentd/etc/fluent.conf; fi -USER 1001 +USER fluent -STOPSIGNAL SIGTERM \ No newline at end of file +STOPSIGNAL SIGTERM