4

我想通过 docker compose 构建 efk logger 系统。一切都设置好了,只有流利的有问题。

流利的 docker 容器日志

2022-02-15 02:06:11 +0000 [info]: 解析配置文件成功 path="/fluentd/etc/fluent.conf"

2022-02-15 02:06:11 +0000 [信息]: gem 'fluent-plugin-elasticsearch' 版本'5.0.3'

2022-02-15 02:06:11 +0000 [信息]:gem 'fluentd' 版本 '1.12.0'

/usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': 无法加载此类文件 -- elasticsearch/transport/transport/connections/selector (LoadError)

我的目录:

我的项目/
 ├─ 流利/
 │ ├─ conf/
 │ │ └── fluent.conf
 │ └── Dockerfile
 └── docker-compose.yml

码头工人-compose.yml:

version: "3"
services:
  web:
    image: httpd
    ports:
      - "8010:80"
    depends_on:
      - fluentd
    logging:
      driver: "fluentd"
      options:
        fluentd-address: 127.0.0.1:24224
        fluentd-async: 'true'
        tag: httpd.access

  fluentd:
    build: ./fluentd
    volumes:
      - ./fluentd/conf:/fluentd/etc
    links:
      - "elasticsearch"
    ports:
      - "24224:24224"
      - "24224:24224/udp"

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.1
    environment:
      - discovery.type=single-node
    expose:
      - 9200
    ports:
      - "9200:9200"

  kibana:
    image: docker.elastic.co/kibana/kibana:7.13.1
    links:
      - "elasticsearch"
    ports:
      - "5601:5601"

Dockerfile:

# fluentd/Dockerfile

FROM fluent/fluentd:v1.12.0-debian-1.0
USER root
RUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-document", "--version", "5.0.3"]
USER fluent

流利的.conf:

<source>
  @type forward
  port 24224
  bind 0.0.0.0
</source>

<match *.**>
  @type copy

  <store>
    @type elasticsearch
    host elasticsearch
    port 9200
    logstash_format true
    logstash_prefix fluentd
    logstash_dateformat %Y%m%d
    include_tag_key true
    type_name access_log
    tag_key @log_name
    flush_interval 1s
  </store>

  <store>
    @type stdout
  </store>
</match>
4

3 回答 3

2

似乎是 elasticsearch 8.0 打破了这个特性。您可以等待修复,在等待时添加类似的内容:

FROM fluent/fluentd:v1.12.0-debian-1.0
USER root
RUN gem uninstall -I elasticsearch && gem install elasticsearch -v 7.17.0
RUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-document", "-- 
 version", "5.0.3"]
USER fluent
于 2022-02-15T12:18:34.513 回答
0

我遇到了同样的问题,但我曾经制作完全相同的图像,直到今天一切正常。我无法弄清楚发生了什么变化。

但是如果您需要紧急解决问题,请使用我的个人形象:

docker pull kurraj/fluentd_castom:latest

我的码头文件:

FROM fluent/fluentd:v1.14-1

USER root

RUN gem update --system && \
gem install fluent-plugin-elasticsearch --source http://rubygems.org
于 2022-02-15T11:35:35.887 回答
0

我有同样的问题,我通过将fluent-plugin-elasticsearch版本更新Dockerfile5.2.0来解决它。

于 2022-02-27T16:59:32.957 回答