Search code examples
elasticsearchfluentd

Fluentd + Elasticsearch = Connection refused


I'm trying to connect fluentd with elasticsearch and I'm getting this error when I start the td-agent service.

td-agent.log:

Could not communicate to Elasticsearch, resetting connection and trying again. Connection refused - connect(2) for 127.0.0.1:9092 (Errno::ECONNREFUSED)

td-agent.conf

<match docker.*>
  @type elasticsearch
  host localhost
  port 9092
  logstash_format true
</match>

My elasticsearch is running because I can check on http://localhost:9200/ and also the fluentd plugin

plugin 2020-05-21 12:57:55 -0300 [info]: gem 'fluent-plugin-elasticsearch' version '4.0.8'

Solution

  • If you can access elasticsearch from localhost:9200 then the .conf will look like:

    <match docker.*>
      @type elasticsearch
      host localhost
      port 9200
      logstash_format true
    </match>