fluent-bit: Cannot tail log files mounted through docker compose volume properly

Bug Report

Describe the bug

Following is the set up.

  • An app server writes a log in /shared/logs/app.log file from host
  • /shared is mounted via docker volume
  • fluentbit:1.5 is running inside the docker container.

Fluentbit server is up and running. It recognizes the input and output.

When the server writes log to the file fluentbit cannot detect the change.

If the app server is closed(terminated) fluentbit recognises the change sends the accumulated log. If I touch app.log then also fluentbit recognises the change.

If I simply run tail -f inside the container then tail picks up the log without having to do touch app.log

To Reproduce

docker-compose.yml

version: '3'
services:
  logserver:
    build:
      context: ./services/fluentbit
    volumes:
      - ./shared:/shared
    container_name: fluentbit

  # The following picks up the log properly
  # image: ubuntu
  # command: tail -F /shared/logs/app.log # build:
  # volumes:
  #   - ./shared:/shared

fluent-bit.conf

[SERVICE]
    log_level debug
    Daemon off
    Flush 5
    Parsers_File parser.conf

# Retrieve valid JSON text messages over file interface
[INPUT]
    Name tail
    Path /shared/logs/app.log
    DB /shared/fluentbit.db
    Tag applog

[INPUT]
    Name tail
    Path /shared/logs/service.log
    DB /shared/fluentbit.db
    Tag servicelog

[FILTER]
    Name         parser
    Parser       docker
    Match        *
    Key_Name     log
    Reserve_Data On

[OUTPUT]
    Name  es
    Match applog
    Host  ${HOST}
    Port  ${PORT}
    Index ${IDX}_app
    Type app
    tls On
    tls.verify Off
    HTTP_User ${USER}
    HTTP_Passwd ${PWD}
    Include_Tag_Key On
    Tag_Key tag

[OUTPUT]
    Name  es
    Match servicelog
    Host  ${HOST}
    Port  ${PORT}
    Index ${IDX}_service
    Type service
    tls On
    tls.verify Off
    HTTP_User ${USER}
    HTTP_Passwd ${PWD}
    Include_Tag_Key On
    Tag_Key tag

Expected behavior

Whenever server writes log in the file fluentbit should pick up the changes (with some buffer) and post it to output. Rightnow the changes are not picked up unless touch app.log is done.

Your Environment

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Same issue. Why is this issue closed? I can cat the logfile, so I guess it is not a permission or containerd (Linux host) issue. Version: 1.9.3-debug

I am having the same issue (not docker compose, just docker volume)