gpt4 book ai didi

docker - 由于 EADDRNOTAVAIL,Fluent-bit 无法将日志发送到 docker 中的 fluentd

转载 作者:行者123 更新时间:2023-12-02 19:54:58 28 4
gpt4 key购买 nike

我正在尝试在 docker 容器上使用 fluent-bit 设置 EFK 堆栈。虽然我可以将日志从 fluent-bit 推送到 elasticsearch,但当我尝试集成 fluentd 时,我遇到了问题。这是确切的错误消息:

unexpected error error_class=Errno::EADDRNOTAVAIL error="Address not available - bind(2) for \"fluent-bit\" port 24224"



我的 中的服务 docker 撰写 文件
  elasticsearch:    image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}    ports:      - '9200:9200'      - '9300:9300'    volumes:      - type: bind        source: ./config/elasticsearch.yml        target: /usr/share/elasticsearch/config/elasticsearch.yml        read_only: true      - type: volume        source: elasticsearch        target: /usr/share/elasticsearch/data    networks:      - efk_1  fluentd:    image: fluent/fluentd:${FLBV}    ports:      - '24224:24224'    volumes:      - type: bind        source: ./config/fluent.conf        target: /fluentd/etc/fluent.conf        read_only: true    networks:      - efk_1    depends_on:      - elasticsearch  fluent-bit:    image: fluent/fluent-bit:${FBITV}    ports:      - '2020:2020'    volumes:      - type: bind        source: ./config/fluent-bit.conf        target: /fluent-bit/etc/fluent-bit.conf        read_only: true      - type: bind        source: ./sample_logs        target: /var/log    networks:      - efk_1    depends_on:      - fluentd

Previously I directly pushed the logs from fluent-bit to elasticsearch like this without fluentd config anywhere:

[SERVICE]
Flush 2
Log_Level debug

[INPUT]
Name tail
Path /var/log/log.txt

[OUTPUT]
Name es
Match *
Host elasticsearch
Port 9200

这成功地将日志推送到elasticsearch,但是现在我在两者之间添加了fluentd,所以fluent-bit会将日志发送到fluentd,然后再推送到elasticsearch。

流利的位conf:
[SERVICE]
Flush 2
Log_Level debug

[INPUT]
Name tail
Path /var/log/log.txt

[OUTPUT]
Name forward
Match *
Host fluentd

流利的conf:
<source>
@type forward
bind fluent-bit
</source>

<match **>
@type stdout
</match>

这给了我错误,因为即使它们是同一个 docker 网络的一部分,它们也无法检测到地址。

这些是我得到的错误:

fluent-bit_1 | [2019/11/06 10:31:02] [error] [io] TCP connection failed: fluentd:24224 (Connection refused)





fluentd_1 | 2019-11-06 10:31:02 +0000 [error]: #0 unexpected error error_class=Errno::EADDRNOTAVAIL error="Address not available - bind(2) for \"fluent-bit\" port 24224"



有人可以帮我知道我在哪里犯了错误吗?

最佳答案

我创建了下一个配置:
docker-compose.yaml

version: "3.7"

services:
fluentd:
image: fluent/fluentd:v1.7.4-1.0
ports:
- '24224:24224'
volumes:
- type: bind
source: ./config/fluent.conf
target: /fluentd/etc/fluent.conf
read_only: true
fluent-bit:
image: fluent/fluent-bit:0.14
ports:
- '2020:2020'
volumes:
- type: bind
source: ./config/fluent-bit.conf
target: /fluent-bit/etc/fluent-bit.conf
read_only: true
- type: bind
source: /var/log/
target: /var/log/
depends_on:
- fluentd

流利的.conf
<source>
@type forward
bind 0.0.0.0
port 24224
</source>

<match test>
@type stdout
</match>

流利的bit.conf
[SERVICE]
Flush 2
Log_Level debug

[INPUT]
Name tail
Path /var/log/syslog
Tag test

[OUTPUT]
Name forward
Match *
Host fluentd

在这些配置中,fluentd run 和 fluent-bit 能够发送 syslog

关于docker - 由于 EADDRNOTAVAIL,Fluent-bit 无法将日志发送到 docker 中的 fluentd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58728575/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com