Skip to content

Filemonitor add truncation support#226

Open
erikjchen wants to merge 4 commits into
microsoft:mainfrom
erikjchen:filemonitor-add-truncation-support
Open

Filemonitor add truncation support#226
erikjchen wants to merge 4 commits into
microsoft:mainfrom
erikjchen:filemonitor-add-truncation-support

Conversation

@erikjchen
Copy link
Copy Markdown

Context & Problem
Currently, LogMonitor tracks file growth using NextReadOffset. However, many containerized logging tools and workloads rotate log files by truncating them in-place (reducing their size to 0) rather than creating a new file. When this happens, NextReadOffset remains at its previous high value, causing LogMonitor to miss new log lines until the truncated file grows past its old size.

Solution
This PR introduces a new opt-in configuration flag, enableTruncationRecovery (default: false). When enabled, LogMonitor detects if a file has been truncated in-place and safely resets the read offset to 0 to capture the new log lines immediately.

@erikjchen
Copy link
Copy Markdown
Author

erikjchen commented May 19, 2026

@microsoft-github-policy-service agree company="Computronix"

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.

2 participants