Соедините aws -elasticssearch с fluentd, используя tdagent - PullRequest
2 голосов
/ 14 февраля 2020

Я успешно подключилasticsearch на локальном компьютере с помощью tdagent, но в стадии инсталляции мне нужно подключиться к awsasticsearch. Если я установил fluentd с помощью ruby, то есть плагин

gem 'fluent-plugin-aws-elasticsearch-service'

Но при использовании fluentd с tdagent, как мы можем настроить aws -elasticsearch?

<match catalog>
  @type elasticsearch
  host https://elastic_devel_aws.com
  # port 9200
  logstash_format true 
  include_timestamp true 
  index_name _logs_test
  flush_interval 10s
  reconnect_on_error true
  reload_on_failure true
  reload_connections false
  request_timeout 120s
  <buffer>
    @type file
   flush_interval 10s
   retry_type periodic
   retry_forever true
   retry_wait 10s
   chunk_limit_size 16Mb
   queue_limit_length 4096
   total_limit_size 60Gb
   path /var/lib/td-agent/buffers/output_elasticsearch-1
 </buffer>
</match> 

При попытке что-то подобное получить

  Could not communicate to Elasticsearch, resetting connection and trying again. getaddrinfo: Name or service not known (SocketError)

1 Ответ

0 голосов
/ 24 февраля 2020

Чтобы установить гем с помощью td-agent, вам нужно выполнить следующую команду

/usr/sbin/td-agent-gem install fluent-plugin-aws-elasticsearch-service'

, и вы можете использовать следующие конфиги для отправки журналов в AWS managed elastcisearch.

<match *.**>
  @type elasticsearch

  host "#{ENV['ELASTICSEARCH_HOST']}"
  port "#{ENV['ELASTICSEARCH_PORT']}"
  scheme "#{ENV['ELASTICSEARCH_SCHEME'] || 'http'}"
  type_name log

  include_tag_key true
  tag_key @logtag

  logstash_format true
  logstash_prefix fos
  logstash_dateformat %Y%m%d

  reconnect_on_error true

  <buffer>
    @type file
    path /fluentd/log/fos/elastic-buffer
    flush_thread_count 8
    flush_interval 1s
    chunk_limit_size 32M
    queue_limit_length 4
    flush_mode interval
    retry_max_interval 30
    retry_forever true
  </buffer>
</match>

Вам также необходимо убедиться, что промежуточной среде разрешен доступ к экземпляру поиска elasti c, это можно проверить, выполнив следующую команду

telnet elastic_devel_aws.com 443
...