首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用tdagent将aws-aws与fluentd连接起来

使用tdagent将aws-aws与fluentd连接起来
EN

Stack Overflow用户
提问于 2020-02-14 20:34:40
回答 1查看 798关注 0票数 2

我已使用tdagent成功连接了本地计算机上的elasticsearch,但在过渡环境中,我需要连接aws elasticsearch,如果我使用ruby安装了fluentd,则会有一个插件

代码语言:javascript
复制
gem 'fluent-plugin-aws-elasticsearch-service'

但是,当使用fluentd和tdagent时,我们如何配置aws-elasticsearch?

代码语言:javascript
复制
<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> 

当尝试使用这样的东西时,

代码语言:javascript
复制
  Could not communicate to Elasticsearch, resetting connection and trying again. getaddrinfo: Name or service not known (SocketError)
EN

回答 1

Stack Overflow用户

发布于 2020-02-24 06:37:01

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

代码语言:javascript
复制
/usr/sbin/td-agent-gem install fluent-plugin-aws-elasticsearch-service'

您可以使用以下配置将日志发送到AWS托管elastcisearch。

代码语言:javascript
复制
<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>

您还需要确保允许staging环境到达弹性搜索实例,您可以通过执行以下命令进行检查

代码语言:javascript
复制
telnet elastic_devel_aws.com 443
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60226473

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档