uken / fluent-plugin-elasticsearch

Apache License 2.0
891 stars 310 forks source link

uninitialized constant Faraday::Error::ConnectionFailed #788

Closed Jigar3 closed 4 years ago

Jigar3 commented 4 years ago

(check apply)

Problem

Can't flush the buffer to Elasticsearch.

I am trying to follow this guide -> https://docs.fluentd.org/v/0.12/articles/docker-logging-efk-compose I also looked at https://github.com/uken/fluent-plugin-elasticsearch/issues/699, but couldn't find a solution for myself. Here is the error which I am getting.

2020-07-26 22:11:20 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2020-07-26 22:11:55 +0000 error_class="NameError" error="uninitialized constant Faraday::Error::ConnectionFailed\nDid you mean?  Faraday::ConnectionFailed" plugin_id="object:3fe9443b59d0"
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/elasticsearch-transport-1.0.18/lib/elasticsearch/transport/transport/http/faraday.rb:44:in `host_unreachable_exceptions'
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/fluent-plugin-elasticsearch-1.9.2/lib/fluent/plugin/out_elasticsearch.rb:354:in `rescue in send_bulk'
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/fluent-plugin-elasticsearch-1.9.2/lib/fluent/plugin/out_elasticsearch.rb:352:in `send_bulk'
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/fluent-plugin-elasticsearch-1.9.2/lib/fluent/plugin/out_elasticsearch.rb:339:in `write_objects'
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/fluentd-0.12.43/lib/fluent/output.rb:490:in `write'
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/fluentd-0.12.43/lib/fluent/buffer.rb:354:in `write_chunk'
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/fluentd-0.12.43/lib/fluent/buffer.rb:333:in `pop'
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/fluentd-0.12.43/lib/fluent/output.rb:342:in `try_flush'
  2020-07-26 22:11:20 +0000 [warn]: /var/lib/gems/2.3.0/gems/fluentd-0.12.43/lib/fluent/output.rb:149:in `run'
2020-07-26 22:11:20 +0000 fluent.info: {"message":"Connection opened to Elasticsearch cluster => {:host=>\"elasticsearch\", :port=>9200, :scheme=>\"http\"}"}
2020-07-26 22:11:20 +0000 fluent.warn: {"next_retry":"2020-07-26 22:11:55 +0000","error_class":"NameError","error":"uninitialized constant Faraday::Error::ConnectionFailed\nDid you mean?  Faraday::ConnectionFailed","plugin_id":"object:3fe9443b59d0","message":"temporarily failed to flush the buffer. next_retry=2020-07-26 22:11:55 +0000 error_class=\"NameError\" error=\"uninitialized constant Faraday::Error::ConnectionFailed\\nDid you mean?  Faraday::ConnectionFailed\" plugin_id=\"object:3fe9443b59d0\""}

...

Steps to replicate

Either clone and modify https://gist.github.com/pitr/9a518e840db58f435911

OR

Provide example config and message

# 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>
# docker-compose.yml
version: '3'

services: 
  web:
    image: httpd
    ports:
      - 80:80
    links: 
      - fluentd
    logging: 
      driver: fluentd
      options:
        fluentd-address: localhost:24224
        tag: http.access

  elasticsearch: 
    image: elasticsearch:7.8.0
    environment:
      - discovery.type=single-node
    expose:
      - 9200
    ports:
      - 9200:9200

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

  kibana:
    image: kibana:7.8.0
    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
    depends_on:
      - elasticsearch
    ports:
      - 5601:5601
# Dockerfile for Fluentd

FROM fluent/fluentd:v0.12.43-debian

RUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-rdoc", "--no-ri", "--version", "1.9.2"]

Expected Behavior or What you need to ask

How can I view the logs on Kibana, because currently, it doesn't show the ES index. ...

Using Fluentd and ES plugin versions

cosmo0920 commented 4 years ago

fluent/fluentd:v0.12.43-debian

This image is outdated. Please use fluent:v1.11.1-debian-1.0 image and fluent-plugin-elasticsearch v4.1.1 instead.

Jigar3 commented 4 years ago

Thanks, it worked