Skip to content

fix(syslog): stop appending the boot drive mirror rule on every apply - #2794

Open
Junker der Provinz (junkerderprovinz) wants to merge 1 commit into
unraid:masterfrom
junkerderprovinz:fix/issue-2782
Open

Junker der Provinz (junkerderprovinz) wants to merge 1 commit into
unraid:masterfrom
junkerderprovinz:fix/issue-2782

Conversation

@junkerderprovinz

@junkerderprovinz Junker der Provinz (junkerderprovinz) commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2782

With "Mirror syslog to boot drive" set to Yes, every Apply on Settings > Syslog Server appended another *.debug ?flash line to /etc/rsyslog.conf, and from there to /boot/config/rsyslog.conf. rsyslog then wrote each message to /boot/logs/syslog once per copy.

The guard is a plain grep, so it reads the pattern as a basic regex. There \? is the optional operator, which means the guard matched *.debug flash but never the *.debug ?flash line that sed writes. Dropping the backslash makes the ? literal. The disable branch uses sed -r, where \? already is a literal ?, so it stays as it is.

I ran the block with GNU grep against a scratch config, three applies each:

rules after 3 applies after mirror off
before 3 0
after 1 0

Servers that already have duplicates keep them until the mirror is switched off and on again.

Thanks Cloud-Tickler for the detailed report and the fix, which this PR applies as proposed.

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of flash-mirroring configuration entries by correctly matching the literal ? character.

In a basic regex \? is the optional operator, so the guard never matched
the "*.debug ?flash" line that sed writes and each Apply added another
copy. Every syslog line then went to the boot device once per copy.

Fixes unraid#2782

Co-authored-by: Cloud-Tickler <127838436+Cloud-Tickler@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4cfcd106-887e-4cd6-a65e-c82598323ff6
📥 Commits

Reviewing files that changed from the base of the PR and between 26eb1b5 and bb4d771.

📒 Files selected for processing: 1
  • emhttp/plugins/dynamix/scripts/rsyslog_config

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The flash-mirroring guard now searches for the literal ? in *.debug ?flash. This lets the check match the rule written to the rsyslog configuration.

Changes

Flash mirror rule

Layer / File(s) Summary
Match the configured rule
emhttp/plugins/dynamix/scripts/rsyslog_config
The grep pattern now treats ? as a literal character when checking for *.debug ?flash.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to bb4d7

No actionable merge-blocking risk remains for this focused guard correction.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the syslog fix and its primary effect: preventing repeated appends of the boot drive mirror rule.
Linked Issues check Passed Issue #2782 requires the plain grep guard in emhttp/plugins/dynamix/scripts/rsyslog_config to match the literal ? in *.debug ?flash. The PR changes '^\\*\\.debug \\?flash$' to `'^\*\.debug ?fla…
Out of Scope Changes check Passed The whole-PR diff contains one targeted change in emhttp/plugins/dynamix/scripts/rsyslog_config. The change directly fixes the duplicate mirror-rule guard from issue #2782. No unrelated source, conf…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Linked Issues check

Explanation

Issue #2782 requires the plain grep guard in emhttp/plugins/dynamix/scripts/rsyslog_config to match the literal ? in *.debug ?flash. The PR changes '^\*\.debug \?flash$' to '^\*\.debug ?flash$'. The sed -ri append rule and the disable branch remain unchanged. The reported three-apply test leaves one rule, and disabling mirroring removes the rules. This satisfies the linked coding requirement.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff contains one targeted change in emhttp/plugins/dynamix/scripts/rsyslog_config. The change directly fixes the duplicate mirror-rule guard from issue #2782. No unrelated source, configuration, or behavior changes are present.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the config line,
The question mark now fits just fine.
One flash rule stays in place,
No extra copies join the race.
I nibble greens and hop away.

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

@github-actions

Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.10.21.2336
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2794/webgui-pr-2794.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix/scripts/rsyslog_config

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2794, or run:

plugin remove webgui-pr-2794

🤖 This comment is automatically generated and will be updated with each new push to this PR.

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.

rsyslog_config: "Mirror syslog to flash" rule is appended again on every Apply — each line written to the boot device N times

1 participant