Skip to content

Add docs for logging env vars and log rotation troubleshooting#763

Open
theodorsm wants to merge 5 commits into
mainfrom
log-docs
Open

Add docs for logging env vars and log rotation troubleshooting#763
theodorsm wants to merge 5 commits into
mainfrom
log-docs

Conversation

@theodorsm
Copy link
Copy Markdown

@theodorsm theodorsm commented May 20, 2026

Adds docs for env variables for logging (including the new NB_LOG_DISABLE_ROTATION) and troubleshooting using external logging rotation (describing also new detection behavior).

Env var page

image

Troubleshooting page

image

Summary by CodeRabbit

  • Documentation
    • Added logging configuration docs introducing environment options for log format, per-file rotation size limits, and an option to disable automatic rotation.
    • Expanded troubleshooting guide explaining client log rotation behavior, archive naming/compression, effects on debug bundles, and how NetBird interacts with or defers to external rotators (with guidance on safe configuration).

Review Change Stack

@theodorsm theodorsm changed the title Add docs for logging env vars Add docs for logging env vars and log rotation troubleshooting May 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

📝 Walkthrough

Walkthrough

Adds a Logging subsection documenting three client environment variables (NB_LOG_FORMAT, NB_LOG_MAX_SIZE_MB, NB_LOG_DISABLE_ROTATION) and a troubleshooting section describing NetBird's default client.log rotation, Linux logrotate detection/hand-off, archive naming/compression, and how to disable built-in rotation.

Changes

Client Logging Configuration

Layer / File(s) Summary
Logging configuration and rotation reference
src/pages/client/environment-variables.mdx, src/pages/help/troubleshooting-client.mdx
New environment variables NB_LOG_FORMAT, NB_LOG_MAX_SIZE_MB, and NB_LOG_DISABLE_ROTATION are documented. Troubleshooting explains default self-rotation, Linux logrotate detection/hand-off, rotated gzipped archive naming, required logrotate settings (e.g., copytruncate), supported compression, an override to force-disable built-in rotation, and a warning about unbounded client.log growth if rotation is disabled without external rotation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰
Logs tumble soft through night and day,
JSON, syslog, or plain text at play,
Size limits nudge when files grow wide,
Turn rotation off — but guard the tide,
NetBird hums, while rabbits watch logs glide.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately summarizes the main changes: documentation additions for logging environment variables and log rotation troubleshooting.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch log-docs

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

@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 (2)
src/pages/help/troubleshooting-client.mdx (2)

111-111: ⚡ Quick win

Clarify the auto-detection bypass example.

The example mentions config "outside /etc/logrotate.d/", but Line 103 states that NetBird scans both /etc/logrotate.conf and /etc/logrotate.d/*. The current phrasing might confuse readers into thinking only /etc/logrotate.d/ is scanned.

📝 Suggested clarification
-If you want to force this behavior on a non-Linux platform, or your `logrotate` config does not match the auto-detection (for example it lives outside `/etc/logrotate.d/` or does not contain the literal string `netbird`), set [`NB_LOG_DISABLE_ROTATION=true`](/client/environment-variables#logging) on the daemon. When the env flag is set, NetBird logs:
+If you want to force this behavior on a non-Linux platform, or your `logrotate` config does not match the auto-detection (for example it lives outside the scanned locations or does not contain the literal string `netbird`), set [`NB_LOG_DISABLE_ROTATION=true`](/client/environment-variables#logging) on the daemon. When the env flag is set, NetBird logs:
🤖 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 `@src/pages/help/troubleshooting-client.mdx` at line 111, Clarify the
auto-detection bypass example by updating the sentence that currently says "for
example it lives outside `/etc/logrotate.d/`" to reflect that NetBird scans both
`/etc/logrotate.conf` and `/etc/logrotate.d/*`; specifically, change the
phrasing in the paragraph containing the NB_LOG_DISABLE_ROTATION example so it
explains a config might be located outside both scanned locations (or not
contain the literal string `netbird`) — reference the phrase around
`NB_LOG_DISABLE_ROTATION=true` and the mention of `/etc/logrotate.d/` to locate
the exact text to edit.

117-119: ⚡ Quick win

Consider using <Warning> instead of <Note> for this critical alert.

This content warns about a serious consequence (unbounded log growth), and the PR description refers to it as a "warning box" and "critical warning." The <Warning> component is available and would better convey the severity. All other <Note> uses in this file (lines 148, 187, 199, 277, 305) are informational rather than cautionary.

⚠️ Suggested component change
-<Note>
+<Warning>
   If you disable built-in rotation without configuring an external rotator, `client.log` will grow without bound. Make sure something is rotating the file before turning rotation off.
-</Note>
+</Warning>
🤖 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 `@src/pages/help/troubleshooting-client.mdx` around lines 117 - 119, Replace
the <Note> wrapper around the critical log-rotation message with the <Warning>
component so the alert displays with appropriate severity; specifically, locate
the block containing the text "If you disable built-in rotation without
configuring an external rotator, `client.log` will grow without bound..." and
change the surrounding <Note>...</Note> to <Warning>...</Warning>, preserving
the inner text and formatting (backticks) and ensuring the closing tag is
updated as well.
🤖 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 `@src/pages/help/troubleshooting-client.mdx`:
- Line 111: Clarify the auto-detection bypass example by updating the sentence
that currently says "for example it lives outside `/etc/logrotate.d/`" to
reflect that NetBird scans both `/etc/logrotate.conf` and `/etc/logrotate.d/*`;
specifically, change the phrasing in the paragraph containing the
NB_LOG_DISABLE_ROTATION example so it explains a config might be located outside
both scanned locations (or not contain the literal string `netbird`) — reference
the phrase around `NB_LOG_DISABLE_ROTATION=true` and the mention of
`/etc/logrotate.d/` to locate the exact text to edit.
- Around line 117-119: Replace the <Note> wrapper around the critical
log-rotation message with the <Warning> component so the alert displays with
appropriate severity; specifically, locate the block containing the text "If you
disable built-in rotation without configuring an external rotator, `client.log`
will grow without bound..." and change the surrounding <Note>...</Note> to
<Warning>...</Warning>, preserving the inner text and formatting (backticks) and
ensuring the closing tag is updated as well.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e0034fe2-0fb5-4dd8-aec9-d281446f241a

📥 Commits

Reviewing files that changed from the base of the PR and between 30cb1bf and c994b67.

📒 Files selected for processing (2)
  • src/pages/client/environment-variables.mdx
  • src/pages/help/troubleshooting-client.mdx

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant