Repository navigation
fix: OpenSearch creates no logs index before its template and retention policy exist - #453
Merged
Merged
Conversation
…on policy exist On prod the collector's first write created logs-2026.10.22 0.3 s before start.sh put the template in, so the index got default mappings and a replica. OpenSearch now starts refusing to auto-create logs- indices, and start.sh allows it once the template and the policy exist, so the step that attached the policy afterwards is gone.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
HardMax71
enabled auto-merge (squash)
October 22, 2026 20:03
|
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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
Small bug found while checking release 2026.10.34 (#452) on prod. The collector's first write created
logs-2026.10.22at 19:57:10.224, 0.3 s before start.sh put the index template in (OpenSearch logged "templates []"). That index got default mappings:attributesandresourceas plain objects, so mixed key types can reject lines, plus one replica that keeps it yellow on a single node.Changes
Compose starts OpenSearch with
action.auto_create_index=-logs-*,+*, so a write can't create alogs-index yet; it getsindex_not_found_exceptionand is dropped, and Loki has the line. start.sh allows auto-creation with a persistent cluster setting once the template and the retention policy exist, so everylogs-index gets both when it's created, and the step that attached the policy afterwards is gone. A restart reads the setting from the data volume.Type of Change
Test Plan
cd backend && uv run pytest tests/unit)cd frontend && npm run test)docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')cd frontend && npm run test:e2e)./deploy.sh openapi, then./deploy.sh types), never edited by handValidation: fresh OpenSearch 3.9 from this branch with a loop writing to today's index every 200 ms. Writes before setup got
index_not_found_exception, the index was then created withtemplates [logs],flat_objectmappings, 0 replicas and thelogs-30dpolicy. After a restart a write created tomorrow's index the same way.Checklist
pre-commit run --all-filesand all checks pass