【问题标题】:Connect aws-elasticssearch with fluentd using tdagent使用 td 代理将 aws-elasticsearch 与 fluentd 连接起来
【发布时间】:2020-02-14 12:34:40
【问题描述】:

我已经使用tdagent成功连接了本地机器上的elasticsearch,但是在暂存环境中我需要连接aws elasticsearch,如果我使用ruby安装了fluentd,那么有一个插件

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)

【问题讨论】:

    标签: elasticsearch fluentd td-agent


    【解决方案1】:

    要使用 td-agent 安装 gem,你需要执行以下命令

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

    您可以使用以下配置将日志发送到 AWS 托管的 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>
    

    您还需要确保暂存环境允许到达弹性搜索实例,您可以通过执行以下命令来检查这一点

    telnet elastic_devel_aws.com 443
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-22
      • 2017-03-09
      • 2021-10-11
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 2021-09-15
      • 1970-01-01
      相关资源
      最近更新 更多