Project Icon

fluentd-docker-image

灵活的日志收集与处理工具

Fluentd官方Docker镜像提供多种操作系统和架构版本,支持自定义配置和插件安装。该镜像能高效收集、处理和转发各类日志数据,适用于容器化环境和云原生场景的日志管理。用户可基于此镜像快速构建定制化的日志收集方案,实现灵活的数据统一和分析。

Fluentd Docker Image

Build Status Docker Stars Docker Pulls

What is Fluentd?

Fluentd is an open source data collector, which lets you unify the data collection and consumption for a better use and understanding of data.

www.fluentd.org

Fluentd Logo

Supported tags and respective Dockerfile links

Current images (Edge)

These tags have image version postfix. This updates many places so we need feedback for improve/fix the images.

Current images use fluentd v1 series.

  • v1.17.0-1.0, v1.17-1, edge [(v1.17/alpine/Dockerfile)][fluentd-1-alpine]
  • v1.17.0-debian-1.0, v1.17-debian-1, edge-debian (multiarch image for arm64(AArch64) and amd64(x86_64))
  • v1.17.0-debian-amd64-1.0, v1.17-debian-amd64-1, edge-debian-amd64 [(v1.17/debian/Dockerfile)][fluentd-1-debian]
  • v1.17.0-debian-arm64-1.0, v1.17-debian-arm64-1, edge-debian-arm64 [(v1.17/arm64/debian/Dockerfile)][fluentd-1-debian-arm64]
  • v1.17.0-debian-armhf-1.0, v1.17-debian-armhf-1, edge-debian-armhf [(v1.17/armhf/debian/Dockerfile)][fluentd-1-debian-armhf]
  • v1.17.0-windows-ltsc2019-1.0, v1.17-windows-ltsc2019-1 [(v1.17/windows-ltsc2019/Dockerfile)][fluentd-1-ltsc2019-windows]
  • v1.17.0-windows-ltsc2022-1.0, v1.17-windows-ltsc2022-1 [(v1.17/windows-ltsc2022/Dockerfile)][fluentd-1-ltsc2022-windows]

Old v1.4 images

This is for backward compatibility. Use "Current images" instead.

v0.12 images

Support of fluentd v0.12 has ended in 2019. We don't recommend v0.12 for new deployment.

You can use older versions via tag. See tag page on Docker Hub.

We recommend to use debian version for production because it uses jemalloc to mitigate memory fragmentation issue.

Using Kubernetes?

Check fluentd-kubernetes-daemonset images.

The detail of image tag

This image is based on the popular Alpine Linux project, available in the alpine official image, and Debian images.

For current images

edge

Latest released version of Fluentd.

vX.Y-A

Latest version of vX.Y Fluentd branch.

A will be incremented when image has major changes.

When fluentd version is updated, A is reset to 1.

vX.Y.Z-A.B

Concrete vX.Y.Z version of Fluentd. This tag is recommeded for the production environment.

A will be incremented when image has major changes. B will be incremented when image has small changes, e.g. library update or bug fixes.

When fluentd version is updated, A.B is reset to 1.0.

debian included tag

The image based on Debian Linux image. You may use this image when you require plugins which cannot be installed on Alpine (like fluent-plugin-systemd).

armhf included tag

The armhf images use ARM base images for use on devices such as Raspberry Pis.

Furthermore, the base images enable support for cross-platform builds using the cross-build tools from resin.io.

In order to build these images natively on ARM devices, the CROSS_BUILD_START and CROSS_BUILD_END Docker build arguments must be set to the shell no-op (:), for example:

docker build --build-arg CROSS_BUILD_START=":" --build-arg CROSS_BUILD_END=":" -t fluent/fluentd:v1.3-onbuild-1 v1.3/armhf/alpine-onbuild

(assuming the command is run from the root of this repository).

For older images

These images/tags are kept for backward compatibility. No update anymore and don't use for new deployment. Use "current images" instead.

stable, latest

These tags are obsolete, already removed to avoid confusing. Use edge, vX.Y-A or vX.Y.Z-A.B images instead.

vX.Y

Latest version of vX.Y Fluentd branch.

vX.Y.Z

Concrete vX.Y.Z version of Fluentd.

onbuild included tag

onbuild images are deprecated. Use non-onbuild images instead to build your image. New images, v1.5 or later, don't provide onbuild version.

debian included tag, armhf included tag

Same as current images.

How to use this image

To create endpoint that collects logs on your host just run:

docker run -d -p 24224:24224 -p 24224:24224/udp -v /data:/fluentd/log fluent/fluentd:v1.3-debian-1

Default configurations are to:

  • listen port 24224 for Fluentd forward protocol
  • store logs with tag docker.** into /fluentd/log/docker.*.log (and symlink docker.log)
  • store all other logs into /fluentd/log/data.*.log (and symlink data.log)

Providing your own configuration file and additional options

fluentd arguments can be appended to the docker run line

For example, to provide a bespoke config and make fluentd verbose, then:

docker run -ti --rm -v /path/to/dir:/fluentd/etc fluent/fluentd -c /fluentd/etc/<conf> -v

The first -v tells Docker to share '/path/to/dir' as a volume and mount it at /fluentd/etc The -c after the container name (fluentd) tells fluentd where to find the config file The second -v is passed to fluentd to tell it to be verbose

Change running user

Use -u option with docker run.

docker run -p 24224:24224 -u foo -v ...

How to build your own image

You can build a customized image based on Fluentd's image. Customized image can include plugins and fluent.conf file.

1. Create a working directory

We will use this directory to build a Docker image. Type following commands on a terminal to prepare a minimal project first:

# Create project directory.
mkdir custom-fluentd
cd custom-fluentd

# Download default fluent.conf and entrypoint.sh. This file will be copied to the new image.
# VERSION is v1.7 like fluentd version and OS is alpine or debian.
# Full example is https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/v1.10/debian/fluent.conf

curl https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/VERSION/OS/fluent.conf > fluent.conf

curl https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/VERSION/OS/entrypoint.sh > entrypoint.sh
chmod +x entrypoint.sh

# Create plugins directory. plugins scripts put here will be copied to the new image.
mkdir plugins

curl https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/Dockerfile.sample > Dockerfile

2. Customize fluent.conf

Documentation of fluent.conf is available at docs.fluentd.org.

3. Customize Dockerfile to install plugins (optional)

You can install Fluentd plugins using Dockerfile. Sample Dockerfile installs fluent-plugin-elasticsearch. To add plugins, edit Dockerfile as following:

3.1 For current images

Alpine version

FROM fluent/fluentd:v1.17-1

# Use root account to use apk
USER root

# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish
RUN apk add --no-cache --update --virtual .build-deps \
        sudo build-base ruby-dev \
 && 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/
COPY entrypoint.sh /bin/

USER fluent

Debian version

FROM fluent/fluentd:v1.17-debian-1

# Use root account to use apt
USER root

# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish
RUN buildDeps="sudo make gcc g++ libc-dev" \
 && apt-get update \
 && apt-get install -y --no-install-recommends $buildDeps \
 && sudo gem install fluent-plugin-elasticsearch \
 && sudo gem sources --clear-all \
 && SUDO_FORCE_REMOVE=yes \
    apt-get purge -y --auto-remove \
                  -o APT::AutoRemove::RecommendsImportant=false \
                  $buildDeps \
 && rm -rf /var/lib/apt/lists/* \
 && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem

COPY fluent.conf /fluentd/etc/
COPY entrypoint.sh /bin/

USER fluent

Note

These example run apk add/apt-get install to be able to install Fluentd plugins which require native extensions (they are removed immediately after plugin installation). If you're sure that plugins don't include native extensions, you can omit it to make image build faster.

3.2 For older images

This section is for existing users. Don't recommend for new deployment.

Alpine version

FROM fluent/fluentd:v1.3-onbuild-1

# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish

RUN apk add --no-cache --update --virtual .build-deps \
        sudo build-base ruby-dev \
 && 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

Debian version

FROM fluent/fluentd:v1.3-debian-onbuild-1

# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish

RUN buildDeps="sudo make gcc g++ libc-dev ruby-dev" \
 && apt-get update \
 && apt-get install -y --no-install-recommends $buildDeps \
 && sudo gem install \
        fluent-plugin-elasticsearch \
 && sudo gem sources --clear-all \
 && SUDO_FORCE_REMOVE=yes \
    apt-get purge -y --auto-remove \
                  -o APT::AutoRemove::RecommendsImportant=false \
                  $buildDeps \
 && rm -rf /var/lib/apt/lists/* \
 && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem

4. Build image

Use docker build command to build the image. This example names the image as custom-fluentd:latest:

docker build -t custom-fluentd:latest ./

5. Test it

Once the image is built, it's ready to run. Following commands run Fluentd sharing ./log directory with the host machine:

mkdir -p log
docker run -it --rm --name custom-docker-fluent-logger -v $(pwd)/log:/fluentd/log custom-fluentd:latest

Open another terminal and type following command to inspect IP address. Fluentd is running on this IP address:

docker inspect -f '{{.NetworkSettings.IPAddress}}' custom-docker-fluent-logger

Let's try to use another docker container to send its logs to Fluentd.

docker run --log-driver=fluentd --log-opt tag="docker.{{.ID}}" --log-opt fluentd-address=FLUENTD.ADD.RE.SS:24224 python:alpine echo Hello
# and force flush buffered logs
docker kill -s USR1 custom-docker-fluent-logger

(replace FLUENTD.ADD.RE.SS with actual IP address you inspected at the previous step)

You will see some logs sent to Fluentd.

References

Docker Logging | fluentd.org

Fluentd logging driver - Docker Docs

Issues

We can't notice comments in the DockerHub so don't use them for reporting issue or asking question.

If you have any problems with or questions about this image, please contact us through a GitHub issue.

[fluentd-1-4-windows]:

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号