官方镜像地址: https://hub.docker.com/_/fluentd
官方文档:https://docs.fluentd.org/container-deployment/

docker

创建配置文件

  1. $mkdir -p /fluentd/etc
  2. $cd /fluentd/etc/
  3. $vim fluent.conf

启动docker 当前的version是1.9的

  1. $ docker run -p 24224:24224 --name fluentd -v $PWD/fluentd/etc:/fluentd/etc fluentd
  2. ....
  3. 2020-08-08 07:52:08 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/fluent.conf"
  4. 2020-08-08 07:52:08 +0000 [info]: gem 'fluentd' version '1.9.1'
  5. 2020-08-08 07:52:08 +0000 [warn]: [output_docker1] 'time_format' specified without 'time_key', will be ignored
  6. 2020-08-08 07:52:08 +0000 [warn]: [output1] 'time_format' specified without 'time_key', will be ignored
  7. 2020-08-08 07:52:08 +0000 [warn]: define <match fluent.**> to capture fluentd logs in top level is deprecated. Use <label @FLUENT_LOG> instead
  8. 2020-08-08 07:52:08 +0000 [info]: using configuration file: <ROOT>

文件路径

  1. $ ls -ll
  2. total 8
  3. drwxr-xr-x 1 fluent fluent 4096 Apr 24 13:23 etc
  4. drwxr-xr-x 2 fluent nogroup 64 Aug 8 07:52 log
  5. drwxr-xr-x 2 fluent fluent 4096 Apr 24 13:23 plugins

配置路径:/fluentd/etc/fluent.conf
日志路径:/fluentd/etc/log/
插件路径 /fluentd/etc/plugins/

docker-compose

https://docs.fluentd.org/container-deployment/docker-compose#step-0-create-docker-compos