Skip to content

Too many open files [errno=24] #12432

Description

@bdurairaji2-lims

Bug Report

Describe the bug

We are experiencing a "Too many open files" error with the Fluent Bit Tail input when monitoring a large number of log files on Windows Server.

Our application is used by approximately 100 users, and approximately 5,000–10,000 audit log files can be generated per day.

Fluent Bit monitors these files using the Tail input and sends the records to OpenSearch.

We have observed that Fluent Bit works normally while the number of files is below approximately 8,200. When the number of files increases beyond approximately 8,200, Fluent Bit starts reporting a "Too many open files" error.

If we manually remove some files and reduce the number of files below approximately 8,200, Fluent Bit starts working normally again.

The files from previous days have already been completely processed and their records have been successfully sent to OpenSearch. However, the files remain on disk because they are required for audit/retention purposes.

We would like to understand how Fluent Bit manages files that have reached EOF and have already been successfully processed.

To Reproduce

  • Rubular link if applicable: Not applicable

  • Example log message if applicable:

[input:tail:tail.90] cannot open E:\LIMSAudit\AuditTextFilePath\solidmedia-478-2026-09-08.json
[2026/09/16 12:33:57.394] [error] [D:\a\fluent-bit\fluent-bit\plugins\in_tail\tail_file.c:1348 errno=24] Too many open files
  • Steps to reproduce the problem:
  1. Configure Fluent Bit Tail input to monitor a directory containing JSON audit log files.
  2. Configure the following settings:
@SET tail_ignore_older=5d
@SET tail_refresh_interval=15
  1. Generate approximately 5,000 files on Day 1.
  2. Allow Fluent Bit to completely process the files and confirm that the records have been successfully delivered to OpenSearch.
  3. Keep the Day-1 files in the audit directory; do not delete them.
  4. On Day 2, generate another approximately 5,000 files.
  5. The directory now contains approximately 10,000 files.
  6. When the number of files reaches approximately 8,200, Fluent Bit starts reporting "Too many open files".
  7. Remove some files so that the number of files falls below approximately 8,200.
  8. Fluent Bit starts processing normally again.

We have reproduced the behavior based on the number of files present in the directory.

Expected behavior

We expect Fluent Bit to continue processing newly created log files even when a large number of previously processed files remain in the directory.

Once a file has:

  • been completely read by Fluent Bit,
  • reached EOF, and
  • had all its records successfully delivered to OpenSearch,

we would expect Fluent Bit to release unnecessary OS file handles/resources associated with that completed file while retaining the required file state/offset information.

The physical audit files must remain on disk for audit and retention purposes.

We expect Fluent Bit to support a directory containing a large number of completed files without failing with "Too many open files", provided the files are no longer being actively written.

Screenshots

If applicable, we can provide screenshots showing:

  • Fluent Bit error
  • Number of files in the directory
  • Fluent Bit process handle count
  • CPU/memory usage

Your Environment

  • Version used: Fluent Bit 5.0.6
  • Configuration:
@SET tail_ignore_older=5d
@SET tail_refresh_interval=15

Additional Tail configuration:

[INPUT]
    Name              tail
    Path              ${audit_base_folder}\specimen-*.json
    Tag               specimen
    Parser            json
    Ignore_Older      ${tail_ignore_older}
    Read_From_Head   True
    Refresh_Interval  ${tail_refresh_interval}
    Read_Newly_Discovered_Files_From_Head True
    DB                <configured DB/state file>
    storage.type      filesystem
  • Environment name and version: Standalone Fluent Bit installation

  • Server type and version: Windows Server 2025

  • Operating System and version: Windows Server 2025

  • Filters and plugins:

    • Tail input
    • JSON parser
    • OpenSearch output
    • Filesystem storage

Additional context

Our LIMS application generates a large number of small audit JSON files. Approximately 5,000–10,000 files can be generated per day.

The files are not continuously modified after they are created. Fluent Bit processes the files and sends their records to OpenSearch. The files must remain on disk for audit and retention requirements.

The important observation is that the issue appears to correlate with the number of files:

  • ~5,000 files → Fluent Bit works normally.
  • ~8,000 files → Fluent Bit continues to work.
  • ~8,200+ files → "Too many open files" occurs.
  • Removing files and reducing the count below ~8,200 → Fluent Bit resumes normal operation.

Concern regarding Ignore_Older

We have configured:

Ignore_Older=5d

However, we do not want to use Ignore_Older as the solution because our requirement is to ensure that all audit files are eventually processed and delivered to OpenSearch.

For example, assume Fluent Bit encounters the "Too many open files" error and remains unavailable for more than 5 days.

During this period, new audit files continue to be generated and remain on disk.

If Fluent Bit resumes after 10 days, files that were not successfully processed may now be older than the configured Ignore_Older=5d period.

Our concern is that these files could then be ignored based on their age, even though their records were never successfully delivered to OpenSearch.

For example:

Day 1
  File created
      ↓
Fluent Bit unable to process file

Day 2–10
  File remains on disk
  Fluent Bit remains unavailable

Day 11
  Fluent Bit resumes
      ↓
  File is older than 5 days
      ↓
  Ignore_Older=5d
      ↓
  File may be ignored
      ↓
  Audit record may not reach OpenSearch

Therefore, reducing the Ignore_Older period or relying on Ignore_Older is not an acceptable solution for our use case.

We need a solution that allows Fluent Bit to:

  1. Continue to retain the physical audit files on disk.
  2. Release unnecessary OS file handles/resources for files that have reached EOF and have been successfully processed.
  3. Retain the required file offset/state information.
  4. Continue processing files that have not yet been successfully processed.
  5. Avoid skipping unprocessed files simply because they have become older than a configured age.
  6. Reliably support a large number of audit files in the directory.

Questions for Fluent Bit Team

Could you please clarify:

  1. After a Tail input file reaches EOF and all records have been successfully delivered to OpenSearch, does Fluent Bit continue to maintain an OS file handle for that file?

  2. Does Fluent Bit continue to actively monitor/track previously completed files while they remain within the Ignore_Older period?

  3. Does the Tail input maintain an open file descriptor/handle for every discovered file, or is there another mechanism for managing a large number of files?

  4. Is there a known limitation or issue with the Tail input on Windows when monitoring approximately 8,000+ files?

  5. Is the approximately 8,200-file threshold related to a Fluent Bit limitation, Windows limitation, or the Tail input's file-handle management?

  6. Is there a recommended configuration that allows Fluent Bit to release OS file handles for completed files while retaining their offset/state information?

  7. Can Fluent Bit distinguish between:

    • files that have been successfully processed and delivered, and
    • files that have not yet been successfully processed,

    so that unprocessed files are not skipped based solely on their age?

  8. What is the recommended Fluent Bit architecture/configuration for processing 5,000–10,000 new files per day while retaining previously processed files on disk?

  9. Would using multiple Tail inputs/directories, or another Fluent Bit configuration, be recommended for this workload?

  10. Is there any specific Fluent Bit 5.0.6 configuration or known issue related to file-handle management that we should consider?

Our primary requirement is data reliability. We need to retain the audit files on disk and ensure that all files are eventually processed and delivered to OpenSearch, even if Fluent Bit is unavailable for an extended period.

We would appreciate your recommended solution for handling this workload without deleting files and without relying on Ignore_Older as a workaround.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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