【问题标题】:logs are not sent to the aggregator server日志不会发送到聚合器服务器
【发布时间】:2022-07-15 19:21:20
【问题描述】:

我有 2 个 ec2 实例 可用区 a 中的第一个实例,可用区 b 中的第二个实例 第一个实例必须将日志转发到第二个实例,但我有一个错误

2022-01-10 20:15:42 +0000 [warn]: detached forwarding server '3.12.161.218:24224' host="3.12.161.218" port=24224 phi=16.01073005960133

3.12.161.218 - 公共 IP 我在配置中尝试了私有 ip

2022-01-10 20:20:25 +0000 [warn]: detached forwarding server '172.31.13.116:24224' host="172.31.13.116" port=24224 phi=16.39846510698621

但是还是不行

我的配置第一个实例(前锋):

<match td.*.*>
  @type tdlog
  apikey YOUR_API_KEY
  auto_create_table
  buffer_type file
  buffer_path /var/log/td-agent/buffer/td

  <secondary>
    @type file
    path /var/log/td-agent/failed_records
  </secondary>
</match>

## match tag=debug.** and dump to console
<match debug.**>
  @type stdout
</match>

## built-in TCP input
## @see http://docs.fluentd.org/articles/in_forward

<source>
  @type forward
  port 24224
</source>

<source>
  @type http
  port 8888
</source>

## live debugging agent

<source>
  @type debug_agent
  bind 127.0.0.1
  port 24230
</source>

<source>
  @type tail
  path /var/log/myapp.log
  pos_file /var/log/td-agent/myorg.log.pos
  tag myorg.myapp
  format /^(?<level>[^ ]*)[ \t]+\[(?<time>[^\]]*)\] \[(?<thread>[^\]]*)\] \[(?<request>[^\]]*)\] (?<class>[^ ]*): (?<message>.*)$/

  time_format %Y-%m-%d %H:%M:%S,%L %z
  timezone +0530
  time_key time
  keep_time_key true
  types time:time
</source>

<match myorg.**>
   @type copy
   <store>
    @type file
    path /var/log/td-agent/forward.log
  </store>

  <store>
    @type forward
    heartbeat_type tcp

    #aggregator IP
    host 172.31.13.116
    flush_interval 30s
  </store>

</match>

聚合器也有问题,它必须将数据传输到 aws 弹性搜索云 配置聚合器:

<source>
  @type forward
   port 24224
</source>

<match myorg.**>
  @type copy
    <store>
    @type file
    path /var/log/td-agent/forward.log
  </store>

  <store>
    @type elasticsearch_dynamic
    #elasticsearch host IP/domain
    host ec2-3-13-147-36.us-east-2.compute.amazonaws.com
    port 9200
    index_name fluentd-${tag_parts[1]+ "-" + Time.at(time).getlocal("+05:30").strftime(@logstash_dateformat)}

    #logstash_format true
    #logstash_prefix fluentd

    time_format %Y-%m-%dT%H:%M:%S
    #timezone +0530
    include_timestamp true

    flush_interval 10s
  </store>
</match>

我不明白如何建立连接以确保一切正常

【问题讨论】:

标签: amazon-web-services amazon-ec2 fluentd aws-elasticsearch


【解决方案1】:

我正在 GCP 中尝试相同的方法。从 GCE 中的 fluentd 代理到 GKE 中运行的 Aggregator fluentd 服务。 fluentd 服务被部署为负载均衡器,并使用它的公共 ip 作为主机我试图发送日志但没有运气。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-20
    • 1970-01-01
    • 1970-01-01
    • 2019-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多