Skip to content

docs: outputs: file: add log rotation support and configuration examples#2572

Open
SagiROosto wants to merge 1 commit into
fluent:masterfrom
SagiROosto:aws-iot-creds-docs
Open

docs: outputs: file: add log rotation support and configuration examples#2572
SagiROosto wants to merge 1 commit into
fluent:masterfrom
SagiROosto:aws-iot-creds-docs

Conversation

@SagiROosto
Copy link
Copy Markdown

@SagiROosto SagiROosto commented May 12, 2026

This is the docs PR for fluent/fluent-bit#11352 about out_file logrotate feature

Summary by CodeRabbit

  • Documentation
    • Added documentation for file output log rotation: new files_rotation option and rotation controls (gzip compression, max_files retention, max_size thresholds), plus a “Log rotation” section detailing timestamped rotated filenames, compression and retention behavior, supported formats, and a YAML/CONF example demonstrating rotation settings.

Review Change Stack

@SagiROosto SagiROosto requested review from a team and eschabell as code owners May 12, 2026 10:48
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a540a597-8416-4017-8b0b-0f3de82c0343

📥 Commits

Reviewing files that changed from the base of the PR and between 3f1a696 and 63477a5.

📒 Files selected for processing (1)
  • pipeline/outputs/file.md
✅ Files skipped from review due to trivial changes (1)
  • pipeline/outputs/file.md

📝 Walkthrough

Walkthrough

Documentation for the File output plugin adds log rotation details: new parameters (files_rotation, gzip, max_files, max_size) in the parameter table and a "Log rotation" section explaining rotation naming, compression, retention, thread-safety, and example configurations.

Changes

File Output Plugin Log Rotation Documentation

Layer / File(s) Summary
Rotation parameter reference
pipeline/outputs/file.md
Parameter table updated with four log rotation configuration options: files_rotation (enable rotation), gzip (compress rotated files), max_files (retention count), and max_size (rotation threshold with size suffixes like 5M, 1G).
Log rotation feature documentation
pipeline/outputs/file.md
New "Log rotation" section describes how rotation is triggered by size, how rotated files are named with timestamps, how gzip compression and retention limits work, notes on thread-safe rotation with workers, compatibility with all output formats, and complete YAML and Fluent Bit config syntax examples.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

5.0.5

Suggested reviewers

  • patrick-stephens

Poem

🐰 I hopped through docs to spin a thread,
Of files that roll when they've grown and sped,
Gzip hugs old tails, numbers fade away,
Max files keep the meadow tidy each day,
A tiny rabbit cheers the plugin's play.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: outputs: file: add log rotation support and configuration examples' directly and clearly describes the main change: adding documentation for log rotation support in the file output plugin with configuration examples.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pipeline/outputs/file.md`:
- Line 123: Update the documentation string that describes the rotation filename
pattern used when files_rotation is enabled: replace the incorrect timestamp
token `YYYMMDD_HHMMSS` with the correct `YYYYMMDD_HHMMSS` in the sentence that
explains how files are renamed (the block referencing `files_rotation` and
`max_size` and the pattern `<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>`).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fff268df-ab55-483a-afc7-89cb4c1a696a

📥 Commits

Reviewing files that changed from the base of the PR and between 9d4bab9 and 713685c.

📒 Files selected for processing (1)
  • pipeline/outputs/file.md

Comment thread pipeline/outputs/file.md Outdated
@SagiROosto SagiROosto force-pushed the aws-iot-creds-docs branch from 2fc7093 to 3f1a696 Compare May 12, 2026 10:53
@eschabell
Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Collaborator

@eschabell eschabell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto see changes to be made first before review passes.

Comment thread pipeline/outputs/file.md Outdated

The plugin retains up to `max_files` rotated files per output file. When the limit is reached, the oldest rotated files are deleted automatically.

Log rotation works with all supported output [formats](#format), including `out_file`, plain, CSV, LTSV, template, and msgpack. File operations are thread-safe, so rotation can be used alongside multiple [workers](../../administration/multithreading.md#outputs).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto can you put back-ticks around all the formats listed here:

  • plain
  • CSV
  • LTSV
  • template
  • msgpack.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pipeline/outputs/file.md (1)

123-123: ⚡ Quick win

Improve grammar and consistency for the timestamp description.

The phrase "The YYYYMMDD_HHMMSS is timestamp of the time when the rotation occurred" is missing an article and should use backticks for consistency with other technical terms in the sentence.

📝 Suggested improvement
-When `files_rotation` is enabled, the plugin monitors the size of each output file. Once a file exceeds `max_size`, the plugin rotates the file by renaming it with a timestamp suffix in the format `<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>`. The YYYYMMDD_HHMMSS is timestamp of the time when the rotation occurred, and `XXXXXXXX` is a random identifier to guarantee unique filenames if multiple rotations happen within the same second.
+When `files_rotation` is enabled, the plugin monitors the size of each output file. Once a file exceeds `max_size`, the plugin rotates the file by renaming it with a timestamp suffix in the format `<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>`. The `YYYYMMDD_HHMMSS` part is the rotation timestamp, and `XXXXXXXX` is a random identifier to guarantee unique filenames if multiple rotations happen within the same second.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pipeline/outputs/file.md` at line 123, The sentence describing the rotation
timestamp is missing an article and inconsistent formatting; update the text
that explains the rotation suffix `<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>`
(referencing `files_rotation` and `max_size`) to say: "The `YYYYMMDD_HHMMSS` is
the timestamp of the time when the rotation occurred" (use backticks around
`YYYYMMDD_HHMMSS` and `XXXXXXXX` for consistency) and ensure the full format is
shown as `<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>` with `XXXXXXXX` described as a
random identifier to guarantee unique filenames if multiple rotations happen
within the same second.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pipeline/outputs/file.md`:
- Line 123: The sentence describing the rotation timestamp is missing an article
and inconsistent formatting; update the text that explains the rotation suffix
`<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>` (referencing `files_rotation` and
`max_size`) to say: "The `YYYYMMDD_HHMMSS` is the timestamp of the time when the
rotation occurred" (use backticks around `YYYYMMDD_HHMMSS` and `XXXXXXXX` for
consistency) and ensure the full format is shown as
`<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>` with `XXXXXXXX` described as a random
identifier to guarantee unique filenames if multiple rotations happen within the
same second.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5451bf1e-296d-4c22-8cd4-392c91258065

📥 Commits

Reviewing files that changed from the base of the PR and between 713685c and 3f1a696.

📒 Files selected for processing (1)
  • pipeline/outputs/file.md

Comment thread pipeline/outputs/file.md Outdated

The File output plugin supports size-based log rotation.

When `files_rotation` is enabled, the plugin monitors the size of each output file. Once a file exceeds `max_size`, the plugin rotates the file by renaming it with a timestamp suffix in the format `<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>`. The YYYYMMDD_HHMMSS is timestamp of the time when the rotation occurred, and `XXXXXXXX` is a random identifier to guarantee unique filenames if multiple rotations happen within the same second.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto also add back-ticks to the "YYYYMMDD_HHMMSS" for consistency.

@eschabell eschabell self-assigned this May 12, 2026
@eschabell eschabell added waiting-for-user Waiting for user/contributors feedback or requested changes waiting-on-code-merge waiting-on-review Waiting on a review from mainteners labels May 12, 2026
Signed-off-by: SagiROosto <sagi.rosenthal@oosto.com>
@SagiROosto SagiROosto force-pushed the aws-iot-creds-docs branch from 3f1a696 to 63477a5 Compare May 12, 2026 12:32
Copy link
Copy Markdown
Contributor

@patrick-stephens patrick-stephens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some queries around bad-path behaviours but nothing blocking, it would be nice to resolve them though for the inevitable failures that people will have.

Comment thread pipeline/outputs/file.md
| Key | Description | Default |
| :--- | :--- | :--- |
| `file` | Set filename to store the records. If not set, the filename will be the `tag` associated with the records. | _none_ |
| `files_rotation` | Enable size-based [log rotation](#log-rotation). When enabled, files that exceed `max_size` are rotated and optionally compressed. | `false` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a query on how this is done, is it as soon as they reach that size or a periodic check or something else?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto can you answer this for @patrick-stephens ?

Comment thread pipeline/outputs/file.md
Comment on lines +17 to +18
| `max_files` | Maximum number of rotated files to retain per output file. Oldest files are deleted first. Must be `1` or greater. Only applies when `files_rotation` is enabled. | `7` |
| `max_size` | Maximum size of the active output file before rotation is triggered. Supports size suffixes: `k` (kilobytes), `m` (megabytes), `g` (gigabytes). Only applies when `files_rotation` is enabled. | `100m` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you do not enable rotation? Does it fail to start, report a warning, etc.?

Similarly what if you use invalid values here? Does it fail with a config error, use the default, etc?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto can you answer this for @patrick-stephens ?

Comment thread pipeline/outputs/file.md

The File output plugin supports size-based log rotation.

When `files_rotation` is enabled, the plugin monitors the size of each output file. Once a file exceeds `max_size`, the plugin rotates the file by renaming it with a timestamp suffix in the format `<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>`. The `YYYYMMDD_HHMMSS` is timestamp of the time when the rotation occurred, and `XXXXXXXX` is a random identifier to guarantee unique filenames if multiple rotations happen within the same second.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the timestamp come from? Is it UTC or local timezone based?

Be nice to have a controllable format for the future too.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto can you answer this for @patrick-stephens ?

Copy link
Copy Markdown
Collaborator

@eschabell eschabell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto can you answer the tagged questions for @patrick-stephens ?

Comment thread pipeline/outputs/file.md
| Key | Description | Default |
| :--- | :--- | :--- |
| `file` | Set filename to store the records. If not set, the filename will be the `tag` associated with the records. | _none_ |
| `files_rotation` | Enable size-based [log rotation](#log-rotation). When enabled, files that exceed `max_size` are rotated and optionally compressed. | `false` |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto can you answer this for @patrick-stephens ?

Comment thread pipeline/outputs/file.md
Comment on lines +17 to +18
| `max_files` | Maximum number of rotated files to retain per output file. Oldest files are deleted first. Must be `1` or greater. Only applies when `files_rotation` is enabled. | `7` |
| `max_size` | Maximum size of the active output file before rotation is triggered. Supports size suffixes: `k` (kilobytes), `m` (megabytes), `g` (gigabytes). Only applies when `files_rotation` is enabled. | `100m` |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto can you answer this for @patrick-stephens ?

Comment thread pipeline/outputs/file.md

The File output plugin supports size-based log rotation.

When `files_rotation` is enabled, the plugin monitors the size of each output file. Once a file exceeds `max_size`, the plugin rotates the file by renaming it with a timestamp suffix in the format `<filename>.<YYYYMMDD_HHMMSS_XXXXXXXX>`. The `YYYYMMDD_HHMMSS` is timestamp of the time when the rotation occurred, and `XXXXXXXX` is a random identifier to guarantee unique filenames if multiple rotations happen within the same second.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SagiROosto can you answer this for @patrick-stephens ?

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

Labels

waiting-for-user Waiting for user/contributors feedback or requested changes waiting-on-code-merge waiting-on-review Waiting on a review from mainteners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants