This skill analyzes ClickHouse system logs health, TTL settings, disk usage, freshness, and cleanup to optimize retention and RCA readiness.
npx playbooks add skill altinity/skills --skill altinity-expert-clickhouse-logs
Answers "are the system logs usable and are they eating the disk?" from system.tables, system.parts, system.disks, system.query_thread_log and system.crash_log. Other skills depend on these tables, so run this first when a pack returns no data.
Run altinity-expert-clickhouse-connection first if the connection mode, cluster and time window are not yet established.
checks.sql — 6 checks emitting Altinity ids A0.2.01 through A0.2.08: query_log and part_log freshness, query_log data older than 30 days, system log tables without TTL, system logs using more than 20 percent of a disk, system.*_logN leftovers from version upgrades, query_thread_log still enabled, and recent crash_log records. Every statement returns rows only when a rule is broken, so an empty result is OK. Check A0.2.01 needs system.part_log, A0.2.07 needs system.query_thread_log and A0.2.08 needs system.crash_log; skip them when those tables are absent.reference.md — background (settings, sizing, anti-patterns); read only when you need to explain a recommendation.; and start with a -- @check <id> <title> header; keep the id with its result.-- @requires: skip the statement when the named table is missing, when keeper is required and the server has no Keeper/ZooKeeper, or when the version condition is not met. List skipped ids with the reason.{cluster} as written when a cluster macro exists; otherwise apply the connection skill's rewrite rule. Any other {placeholder} is a template variable: substitute a real value first or skip the statement.UNKNOWN_IDENTIFIER, run DESCRIBE TABLE system.<table> and drop the missing column.severity column is the verdict for that row. Copy it; do not re-grade.ALTER TABLE system.<name> MODIFY TTL event_date + INTERVAL <n> DAY:| Table | Retention | Notes |
|-------|-----------|-------|
| query_log | 7-30 days | The main forensic table; keep 30 days if disk allows. |
| query_thread_log | disable, or 3 days | One row per thread per query. Very verbose and rarely needed. |
| part_log | 14-30 days | Needed for merge, mutation and ingestion root cause analysis. |
| trace_log | 3-7 days | Large; only useful while profiling. |
| text_log | 7-14 days | Needed to read errors and warnings in context. |
| metric_log | 7-14 days | One row per second per host; useful for trending. |
| asynchronous_metric_log | 7-14 days | Low volume. |
| crash_log | 90 days or more | Tiny and rarely written; keep it long. |
system._log1, _log2 and similar (A0.2.06) are leftovers: on upgrade ClickHouse renames an incompatible log table and starts a new one. They are never read again and should be dropped once the old data is no longer needed.system.text_log before attributing any other finding to the same incident.TRUNCATE TABLE system.<name> or by dropping old partitions.check, severity, object, evidence, recommendation; one row per finding, Critical first. Evidence quotes the numbers from the result rows.altinity-expert-clickhouse-storagealtinity-expert-clickhouse-part-logaltinity-expert-clickhouse-metricsaltinity-expert-clickhouse-reportingaltinity-expert-clickhouse-overviewWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.