我正在尝试配置docker-compose文件以使用fluent-bit。在我的docker-compose文件中,我有以下fluentbit的配置
fluentbit:
image: fluent/fluent-bit:1.0.4
command: /fluent-bit/bin/fluent-bit -c /fluent-bit/etc/fluent-bit.conf
volumes:
- ./docker_to_es.conf:/fluent-bit/etc/fluent-bit.conf
networks:
- monitor我使用docker-compose up运行它,一切看起来都很好。为了进行测试,我执行以下操作:
docker run --network=monitor --log-driver=fluentd --log-opt fluentd-address=192.168.XX.XX:24224 -t ubuntu echo "test logging"
测试是成功的,但我必须查找容器的fluentd-address。在docker-compose文件中,我不能以这种方式输入地址。
在docker compose文件中,我添加了另一个服务。
my-service
logging:
driver: fluentd
options:
fluentd-address: fluentbit:24224
networks:
- monitor我在这里使用fluentbit服务的名称作为hostname。但这是行不通的。
有人知道如何让我的服务将日志推送到fluentbit中吗?
fluent_bit.conf文件
[SERVICE]
Flush 5
Daemon Off
Log_Level debug
[INPUT]
Name forward
Listen fluentbit
Port 24224
[OUTPUT]
Name es
Match *
Host elasticsearch
Port 9200
Index fluentbit
Type docker发布于 2019-09-20 15:33:54
Docker日志记录在主机网络中工作,但您可以在内部监控网络中流畅地运行...您需要进行从fluentbit到主机的端口转发,并将日志记录驱动配置为本地主机,或者在net_mode: host中运行fluentbit
https://stackoverflow.com/questions/55232151
复制相似问题