简体   繁体   中英

Fluentd with elasticsearch unreachable_exception

I am setting up elasticsearch and fluentd in a docker i am getting host_unreachable_exceptions . Below is my full exception log:

2020-02-13 08:45:05 +0000 [error]: #0 unexpected error error_class=NameError error="uninitialized constant Faraday::Error::ConnectionFailed"
  2020-02-13 08:45:05 +0000 [error]: #0 /usr/lib/ruby/gems/2.5.0/gems/elasticsearch-transport-7.4.0/lib/elasticsearch/transport/transport/http/faraday.rb:51:in `host_unreachable_exceptions'
  2020-02-13 08:45:05 +0000 [error]: #0 /usr/lib/ruby/gems/2.5.0/gems/fluent-plugin-elasticsearch-4.0.3/lib/fluent/plugin/elasticsearch_index_template.rb:36:in `rescue in retry_operate'
  2020-02-13 08:45:05 +0000 [error]: #0 /usr/lib/ruby/gems/2.5.0/gems/fluent-plugin-elasticsearch-4.0.3/lib/fluent/plugin/elasticsearch_index_template.rb:34:in `retry_operate'
  2020-02-13 08:45:05 +0000 [error]: #0 /usr/lib/ruby/gems/2.5.0/gems/fluent-plugin-elasticsearch-4.0.3/lib/fluent/plugin/out_elasticsearch.rb:282:in `configure'

My docker-compose file is:

version: '3'
services:

    elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
      container_name: Eagle_Core_local_elasticsearch
      environment:
        - xpack.security.enabled=false
        - discovery.type=single-node
      ulimits:
        memlock:
          soft: -1
          hard: -1
        nofile:
          soft: 65536
          hard: 65536
      cap_add:
        - IPC_LOCK
      volumes:
        - ./../../../data/elasticsearch-data:/usr/share/elasticsearch/data
      networks:
        - eaglenet
      ports:
        - 9200:9200
        - 9300:9300

    fluentd:
      container_name: Eagle_Core_FluentLogger
      build:
        context: ./docker-conf/fluentd
      environment:
        - FLUENT_UID=1000
      networks:
        - eaglenet
      ports:
        - "24231:24231"
      volumes:
        - ./../../../log/fluentd:/fluentd/log
        - ./docker-conf/fluentd/fluent.conf:/fluentd/etc/fluent.conf
      logging:
        driver: "json-file"
        options:
          max-size: "200k"
          max-file: "3"
      env_file:
        - ./local.config.env

and here is my fluent.conf :

<match flight.error.log>
  @type elasticsearch
  host elasticsearch
  port 9200
  utc_index false
  target_index_key @target_index
  logstash_prefix ${tag}
  logstash_dateformat %Y%m%d
  type_name error_log
  <buffer>
    flush_interval 2s
    chunk_limit_size 64m
    flush_thread_count 4
    @type file
    path /fluentd/log/flight
  </buffer>
</match>

Note: I can ping elasticsearch:9200 from fluentd container

I have same problem too. please look this https://github.com/uken/fluent-plugin-elasticsearch/issues/699 , lucasteles22 said need modify the script elasticsearch-transport-7.4.0/lib/elasticsearch/transport/transport/http/fa raday.rb:51. I tried it and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM