Repository navigation
fix(ops): add logrotate installer and stack rotation validation (#100) - #106
Merged
Merged
Conversation
Provides scripts/install-logrotate.sh to install and verify the host logrotate drop-in (/etc/logrotate.d/localobserve) for bounding results.log and other OTel-tailed files to 50M/100M via copytruncate. Adds tests/test_stack_rotation.py verifying config syntax, copytruncate semantics, bounded maxsize directives, and tailing continuity. Updates Taskfile.yml rotate-logs task to use the installer helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #100.
Adds
scripts/install-logrotate.shandtests/test_stack_rotation.pyto support, verify, and automate host log rotation for LocalObserve log files (.data/osquery/osqueryd.results.log,.data/falco/events.jsonl, etc.).Context & Implementation
.data/osquery/osqueryd.results.loggrows unbounded if host logrotate is unconfigured.scripts/logrotate-localobserve.confdefines weekly rotation and a 50Mmaxsizeceiling withcopytruncateto preserve the inode and ensure the OpenTelemetry Collector'sfile_logreceiver continues tailing across rotations without gap or desynchronization.scripts/install-logrotate.shsupporting:--dry-run: validates configuration syntax without making changes.--status: displays active log sizes and installation status.--force: forces immediate log rotation using an isolated status file.--install: installs/etc/logrotate.d/localobservewith dynamically resolved repository paths.tests/test_stack_rotation.pyverifying:logrotate -d).copytruncateacross all log sections.maxsizeboundary enforcement (<= 50M for osquery).Taskfile.ymlrotate-logstask to utilize the installer script.Verification
bash scripts/install-logrotate.sh --dry-run: exit=0, valid syntax.bash scripts/install-logrotate.sh --status: output verified.uv run pytest tests/test_stack_rotation.py: 7 passed in 0.08s.uv run pytest tests/: 361 passed, 40 skipped across the full test suite.