Skip to content

Instantly share code, notes, and snippets.

@haeramkeem
Created August 3, 2022 04:26
Show Gist options
  • Save haeramkeem/e3383c1e2818269d53570eb0ac722817 to your computer and use it in GitHub Desktop.
Save haeramkeem/e3383c1e2818269d53570eb0ac722817 to your computer and use it in GitHub Desktop.

docker.io/haeramkeem/fluentd-es:7.17-1.14

Source: https://github.com/haeramkeem/multidockers/tree/main/fluentd-es-sidecar

Build image

docker build -t $IMAGE_TAG .

ARGs

  1. FLUENTD_VER: Version of the Fluentd image. Default is v1.14-1
  2. ES_CLIENT_VER: Version of the Elasticsearch client package. Default is 7.17.1

Environment variables

  1. ES_HOST_URL: URL of the Elasticsearch. No defaults.
  2. ES_HOST_PORT: Port of the Elasticsearch. Default is 9200
  3. SRC_FORMAT: Format of the source data. Default is none
  4. SRC_FILE_PATH: Path of the source file. No defaults.
  5. SRC_TAG: Fluentd tag of the souce data. Defaults is mypod.

Releases

Official docker image can be found in here

# FLUENTD + ELASTICSEARCH sidecar image
# @see https://github.com/fluent/fluentd-docker-image#alpine-version
# Build defaults
# You may have to use `docker build --build-arg ...` to overwrite the default values
ARG FLUENTD_VER=v1.14-1
FROM fluent/fluentd:$FLUENTD_VER
ARG ES_CLIENT_VER=7.17.1
# Runtime defaults
# You may have to use `docker run --env ...` to overwrite the defualt values
ENV SRC_FORMAT=none
ENV ES_HOST_PORT=9200
ENV SRC_TAG=mypod
USER root
RUN apk add --no-cache --update --virtual .build-deps \
sudo build-base ruby-dev \
&& sudo gem install elasticsearch -v $ES_CLIENT_VER \
&& sudo gem install fluent-plugin-elasticsearch \
&& sudo gem sources --clear-all \
&& apk del .build-deps \
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
COPY fluent.conf /fluentd/etc/
USER fluent
<source>
@type tail
format "#{ENV['SRC_FORMAT']}" # Default: 'none'
path "#{ENV['SRC_FILE_PATH']}" # Default: ''
pos_file "#{ENV['SRC_FILE_PATH']}.pos" # Default: '.pos'
tag "#{ENV['SRC_TAG']}" # Default: 'mypod'
</source>
<match **>
@type elasticsearch
host "#{ENV['ES_HOST_URL']}" # Default: ''
port "#{ENV['ES_HOST_PORT']}" # Default: '9200'
logstash_format true
logstash_prefix "fluentd.#{ENV['SRC_TAG']}" # Default: 'fluentd.mypod'
</match>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment