I want to build the efk logger system by docker compose. Everything is setup, only fluentd has problem.
fluentd docker container logs
2022-02-15 02:06:11 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/fluent.conf"
2022-02-15 02:06:11 +0000 [info]: gem 'fluent-plugin-elasticsearch' version '5.0.3'
2022-02-15 02:06:11 +0000 [info]: gem 'fluentd' version '1.12.0'
/usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- elasticsearch/transport/transport/connections/selector (LoadError)
my directory:
my project/ ├─ fluentd/ │ ├─ conf/ │ │ └── fluent.conf │ └── Dockerfile └── docker-compose.yml
docker-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
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>
gem list
viadocker exec
in a running container. – AntiperistalsisRUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-document", "--version", "5.0.3"]
invalid? – PantomimeRUN gem install fluent-plugin-elasticsearch -v 5.0.3 --no-document
– Antiperistalsis