Skip to content

in_tail: Fluent Bit fails to start when monitoring a large number of files #11272

@khalillilahk

Description

@khalillilahk

Bug Report

Describe the bug
Fluent Bit fails to start when configured to monitor and ship a very large number of files (approximately 55,000).

To Reproduce

  • Create a directory containing 55,000+ files.
  • Start Fluent Bit using the tail input plugin and file output plugin.
  • Observe the startup failure with the following error:
Fluent Bit v4.0.10
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _             ___  _____
|  ___| |                | |   | ___ (_) |           /   ||  _  |
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| || |/' |
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| ||  /| |
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |\ |_/ /
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)___/


[2025/11/26 11:11:17] [ info] [fluent bit] version=4.0.10, commit=af80d63922, pid=966
[2025/11/26 11:11:17] [ info] [storage] ver=1.5.3, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/11/26 11:11:17] [ info] [simd    ] disabled
[2025/11/26 11:11:17] [ info] [cmetrics] version=1.0.5
[2025/11/26 11:11:17] [ info] [ctraces ] version=0.6.6
[2025/11/26 11:11:17] [ info] [input:tail:tail.0] initializing
[2025/11/26 11:11:17] [ info] [input:tail:tail.0] storage_strategy='memory' (memory only)
[2025/11/26 11:12:51] [error] [input:tail:tail.0] error preparing database SQL statement: stmt_delete_inodes sql:DELETE FROM in_tail_files WHERE inode NOT IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,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?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
[2025/11/26 11:12:51] [error] failed initialize input tail.0
[2025/11/26 11:12:51] [error] [engine] input initialization failed

Expected behavior
Fluent Bit should start successfully and process all log files without errors.

Your Environment

  • Version used: 4.0.10
  • Configuration:
service:
  http_server: on
  http_listen: localhost
  http_port: ${HEALTH_CHECK_PORT}
  health_check: on

pipeline:
  inputs:
    - name: tail
      path: path/to/files/*, path/to/files/*/*, path/to/files/*/*/*
      exclude_path: '*.log.0,*.log.1,*.log.2,*.log.3,*.log.4,*.log.5
      tag_regex: (path/to/files/*|path/to/files/*/*|path/to/files/*/*/*)(?<original_path>.*)
      tag: tail:<original_path>
      read_from_head: true
      skip_long_lines: true
      ignore_older: 1d
      db: offsets.db
      db.locking: true
      inotify_watcher: false
      mem_buf_limit: 256MB
  filters:
    - name: lua
      match: tail:*
      script: compute_target_path.lua
      call: compute_target_path

    - name: rewrite_tag
      match: tail:*
      rule: $target_path ^(.*)$ $1 false

  outputs:
    - name: file
      match: '*'
      path: output/path
      mkdir: true
      format: template
      template: '{log}'

  • Environment name and version: docker container but you I think you will get the same issue locally as well
  • Operating System and version: rhel-9
  • Filters and plugins: see the configuration provided, but the issue is mainly coming from input tail plugin

Additional context
We are attempting to ship a very large number of log files (>50,000). The issue appears to originate from the tail input plugin when handling large datasets.

Suspected Root Cause

  • The error occurs during initialization of the tail input when it prepares a SQL statement to clean up file entries in the tail plugin’s state database.
  • The log shows a DELETE FROM in_tail_files WHERE inode NOT IN (?,?,...,?) with a very large number of placeholders, which means that with ~55k files, the initial cleanup step generates a NOT IN list that is far larger than typical parameter limits leading to the startup failure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions