Repository navigation
The bundled ClickHouse keeps query_log and text_log for 30 days - #828
Merged
zlareb1 merged 5 commits intoNov 18, 2026
Merged
Conversation
A refused statement's error can quote an allowlisted metadata value it failed on, and erasure reaches neither system log. ClickHouse's default configuration sets no TTL on them, so the rows stayed until an operator bounded them. system_logs.xml sets a 30-day TTL on both logs. compose.yaml, the CI ClickHouse, the release bundle and the Helm chart's dev ClickHouse mount it. The deployment guide gives the same file for self-managed servers and says what happens to the old tables: on the first start with the file, ClickHouse renames them to query_log_0 and text_log_0 and keeps them with no TTL, so an operator drops them. Closes: ClickHouse#436 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Enrico Convento <[email protected]>
The assistant's retention table said 30 days for the whole server log, which also covers ClickHouse's file log, rotated by size. It now names system.query_log and system.text_log. The production checklist points a self-managed server at system_logs.xml. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Enrico Convento <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Enrico Convento <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Enrico Convento <[email protected]>
On a server whose configuration has no text_log, a <text_log> element creates system.text_log at trace level. The guide says to keep only the query_log block there. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Enrico Convento <[email protected]>
zlareb1
approved these changes
Nov 18, 2026
zlareb1
left a comment
Member
There was a problem hiding this comment.
No findings in the log TTLs, config mounts, release bundle, Helm template or documented restart behavior. The 63 focused config and bundle tests pass locally. All 49 checks and all matching parent workflows pass; intervening main changes do not overlap the deployment paths.
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.
Closes: #436
Related: #428
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
The bundled ClickHouse and the Helm chart's dev ClickHouse keep 30 days of
system.query_logandsystem.text_logrows. The deployment guide gives the same configuration file for a self-managed server. An existing install keeps its earlier rows insystem.query_log_0andsystem.text_log_0until you drop them (deployment guide, Log retention).Why
A refused statement's error can quote the allowlisted metadata value it failed on, such as a memory key, a title or a user id. Erasure reaches neither system log, and ClickHouse's default configuration sets no TTL on them, so those rows stayed until an operator bounded them. #428 left this for its own change because a TTL change to a system log renames the existing table on the next start.
Scope and risk
deploy/clickhouse-config/system_logs.xmlsetsevent_date + INTERVAL 30 DAY DELETEonquery_logandtext_log.compose.yaml,dev/ci_start_clickhouse.sh, the release bundle (scripts/release/build_stack_bundle.py) and inline in the Helm chart's dev ClickHouse (deploy/helm/loom/templates/dev-clickhouse.yaml, ConfigMap key and volume mount).docs/operations/deployment.md(the file for self-managed servers, the_0rename, dropping the old tables);docs/architecture/assistant.mdanddocs/features/memory/retention-and-erasure.mdno longer say the logs have no TTL.scripts/gates/mixed_version.pyandtests/analyzer/README.mdstart short-lived containers that do not mountsystem_logs.xml; a log TTL changes nothing there.insights.queryand anything else that readssystem.query_logsees at most 30 days.Compatibility, rollout and rollback
system.query_log_0andsystem.text_log_0, keeps them with their rows and no TTL, and creates new logs. Read what you need from the old tables, thenDROP TABLE IF EXISTS system.query_log_0; DROP TABLE IF EXISTS system.text_log_0;. A self-managed server gets the TTL only by adding the same file toconfig.d/._Nname and creates them again with no TTL. No migration, no generated files.Tests
tests/unit/test_deploy_clickhouse_config.py: one test thatsystem_logs.xmlsets the 30-day TTL on both logs, one that the Helm chart's inline copy matches the file (fails when the chart's TTL is changed).SHOW CREATE TABLE system.query_logandsystem.text_logshowTTL event_date + toIntervalDay(30); the old tables becamequery_log_0andtext_log_0with their rows and no TTL;DROP TABLEon them works; a second TTL change renames to the next free_Nname, which keeps its old TTL.<text_log>block removed fromconfig.xmlandsystem_logs.xmlinconfig.d/:system.text_logexists and records Trace rows, as with the default configuration. The deployment guide says to keep only the<query_log>block on such a server.main:ruff format --check,make lint, andpytest tests/unit/test_deploy_clickhouse_config.py tests/unit/test_public_copy.py tests/unit/test_doc_links.py tests/unit/test_agent_instructions.py(474 passed). Before the rebase:helm lint --strictwithvalues-kind.yaml, and the rendered ConfigMap XML parses.shfmt(the shell half ofmake format-check),make typecheck, the fullmake test-unit, and kubeconform.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. I checked the TTL behaviour and the
_0rename against a real ClickHouse, and the Helm copy against the file.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.main; no merged migration is edited. (No migration.)frontend/changed. (Not changed.)docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code