2

I am trying to configure the docker-compose file to utilize fluent-bit. In my docker-compose file I have the following config for 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

I run this using docker-compose up and everything looks fine. To test I do the following:

docker run --network=monitor --log-driver=fluentd --log-opt fluentd-address=192.168.XX.XX:24224 -t ubuntu echo "test logging"

The test is successful but I had to lookup the fluentd-address for the container. In the docker-compose file I won't be able to input the address that way.

Inside the docker compose file I add another service.

my-service
  logging:
    driver: fluentd
    options:
      fluentd-address: fluentbit:24224
  networks:
    - monitor

I use the name of the fluentbit service here as a hostname. But this does not work.

Does anyone know how I can get my service to push logs into fluentbit?

fluent_bit.conf file

[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
M.Holmes
  • 403
  • 1
  • 7
  • 22
  • 1
    Possible duplicate of [Can't log from (fluentd) logdriver using service name in compose](https://stackoverflow.com/questions/45346005/cant-log-from-fluentd-logdriver-using-service-name-in-compose) – nickgryg Mar 20 '19 at 00:17
  • @Nickolay thank you! – M.Holmes Mar 20 '19 at 15:41

1 Answers1

2

Docker logging work in hosts network, but you fluentbit running in internal monitor network ... you need make port-forwarding from fluentbit to host and configure logging driver to localhost, or run fluentbit in net_mode: host

Ksandr Ki
  • 31
  • 2