From 595e00d56521c162f068cf97aa65bc2a0d8b3a60 Mon Sep 17 00:00:00 2001 From: "tinycloud-bot[bot]" <348376441+tinycloud-bot[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 12:31:22 +0000 Subject: [PATCH 1/5] telemetry: ship the deletion ledger start line and name the DuckDB cache cleanup warning (TC-4177, TC-4190) - log-shipper: individual event deletion_ledger_start (target tinycloud, info) with ledger_file, bytes, operations, key_entries, committed, aborted, newest_deleted_at; failure variant carries error_kind only. Gate, sanitize.vrl block, own route and sink input, cases.mjs Vector cases. - log-shipper: diagnostics.json maps 'Database cache cleanup failed' to duckdb_cache_cleanup_failed; the line at duckdb/database.rs is a warn! again (#647 demoted it). - Schema pinned to tinycloud-dev-sam ab0c591b (fields.json sha256 4143ff50...), regenerated VECTOR_CONFIG_JSON in the compose and the N0 fixture, n0_template_hash and docs/releasing.md for THIS branch on main; the hash is recomputed once on top of the ingress changes before merge. - New log-shipper/ledger-start.test.mjs (schema carries every shipped field, own route, gate, TC-4190 mapping), registered in logship.yml. Details: TC-4177, TC-4190 --- .github/workflows/docker.yml | 6 +-- .github/workflows/logship.yml | 2 +- CHANGELOG.md | 2 + docker-compose.dstack-postgres.yaml | 2 +- docs/releasing.md | 7 +-- log-shipper/canonical.json | 4 +- log-shipper/cases.mjs | 63 ++++++++++++++++++++++- log-shipper/diagnostics.json | 1 + log-shipper/fields.json | 46 +++++++++++++++-- log-shipper/ledger-start.test.mjs | 46 +++++++++++++++++ log-shipper/ledger.mjs | 12 +++++ log-shipper/sanitize.vrl | 31 +++++++++++ scripts/ci/fixtures/tc959-n0-compose.yaml | 2 +- scripts/tc959-logship.mjs | 18 +++++-- tinycloud-core/src/duckdb/database.rs | 7 ++- 15 files changed, 226 insertions(+), 23 deletions(-) create mode 100644 log-shipper/ledger-start.test.mjs diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 709895b2..c1d05cf6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -832,14 +832,14 @@ jobs: # DstackKmsEpoch epoch-0 pins opened from root_wrap, no key-recovery sidecar, the TC-287 retention # sweeper env line, the TC-1791 delegated SQL caveats env line, the TC-1491 SQL size-cap and # free-disk env lines, the TC-3739 node_request DB timing fields, the TC-3834 node_request - # error_code, the TC-3284 deletion ledger error events and the TC-3284 named node diagnostics and the TC-3973 startup events in the Vector config - # (raw 7cc95bde…; e0f99bcc… / a8fb25f7… before TC-3973; 97a180a4… / bced82d3… before the named diagnostics, db348152… / 27287a38… before TC-3284, cc219eb5… / 02d90755… before TC-3834, c6d05e1e… / 46287bc3… before TC-3739, + # error_code, the TC-3284 deletion ledger error events and the TC-3284 named node diagnostics and the TC-3973 startup events and the TC-4177 deletion ledger start line and the TC-4190 duckdb_cache_cleanup_failed code in the Vector config + # (raw 70b3ee6e…; 8c8785fb… / 7cc95bde… before TC-4177 and TC-4190; e0f99bcc… / a8fb25f7… before TC-3973; 97a180a4… / bced82d3… before the named diagnostics, db348152… / 27287a38… before TC-3284, cc219eb5… / 02d90755… before TC-3834, c6d05e1e… / 46287bc3… before TC-3739, # e5f1c356… / d1d2ef49… before the TC-1491 caps, # e1cf031b… / f4f51e75… before TC-1791, 6a577c6d… / 272f43b8… before TC-287, # 70c71aa0… / 8e602959… with the sidecar, 417719648a0c… / d6af7a70… before TC-3554, # 5419a6fb… before TC-1491, d703d69b… before TC-2917, 298ea356… before TC-2346, # 192dfb7e… before TC-1777), its single node digest normalized to 64 zeros. - n0_template_hash = '8c8785fbc80e2dc16358abe0304cec32235367c9b9cfc5e1776704f7019af4f8' + n0_template_hash = '0d9f299592c7abeac31a425982f71be30e24122c6d75881588e169417bb0f296' node_pin = re.compile(rb'(?m)^ image: ghcr\.io/tinycloudlabs/tinycloud-node@sha256:([0-9a-f]{64})$') def n0_template(raw): pins = list(node_pin.finditer(raw)) diff --git a/.github/workflows/logship.yml b/.github/workflows/logship.yml index f04b79d4..fa38302d 100644 --- a/.github/workflows/logship.yml +++ b/.github/workflows/logship.yml @@ -39,7 +39,7 @@ jobs: with: node-version: 22 - name: Verify request budgets and hosted acceptance guards - run: node --test log-shipper/budget.test.mjs log-shipper/profile.test.mjs log-shipper/ledger.test.mjs scripts/tc959-docker.test.mjs scripts/tc959-readiness.test.mjs + run: node --test log-shipper/budget.test.mjs log-shipper/profile.test.mjs log-shipper/ledger.test.mjs log-shipper/ledger-start.test.mjs scripts/tc959-docker.test.mjs scripts/tc959-readiness.test.mjs - name: Check schema provenance and compose boundary without env interpolation run: node scripts/tc959-check.mjs - name: Install checksum-pinned native Vector diff --git a/CHANGELOG.md b/CHANGELOG.md index b551277b..6320ebae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ - SQL databases over the checkpoint save size limit remain readable and reject mutations before execution. Details: TC-1491. - Ops: added a reversible local-config HTTP ingress switch and operator runbook for a separately verified independent Cloudflare origin. Dry-run is the default; production routing and policy execution remain separate. Details: TC-1387. - Production compose: stored SQL databases up to 320 MiB load again; saves still stop at 64 MiB (`TINYCLOUD_STORAGE__SQL__MAX_ARTIFACT_READ_BYTES: "320 MiB"`). Config only, no migration. Details: TC-1491. +- **Production compose:** the log shipper's `VECTOR_CONFIG_JSON` ships the node's one deletion-ledger line per start as the individual event `deletion_ledger_start` (`ledger_file` missing/empty/present, `bytes`, `operations`, `key_entries`, `committed`, `aborted`, `newest_deleted_at`; counts only, no ids or paths), so an OS move or deploy can compare the ledger before and after, and names the DuckDB cache cleanup warning `duckdb_cache_cleanup_failed`. The N0 compose template hash moves (`docs/releasing.md` has the values; recompute it once on top of the ingress changes that share this deploy). Details: TC-4177, TC-4190. +- DuckDB: a failed cache cleanup is a `warn` again (event `duckdb_cache_cleanup_failed`), shipped as a counted diagnostic. #647 had demoted it to `debug` because no event code existed. Details: TC-4190. - DuckDB: the node opens and ends every transaction itself; client requests that send transaction control (`BEGIN`, `START TRANSACTION`, `COMMIT`, `END`, `ROLLBACK`, savepoints) are refused at every tier, and the SDK's `transactional` batches are unchanged. `nextval` and `setval` count as writes, so a read-tier or `readOnly` request is refused them. Line comments are parsed more strictly. Details: TC-3430. - DuckDB: a request marked `readOnly` allows only queries and `EXPLAIN`, whatever its ability tier. Transaction control (`BEGIN`, `COMMIT`, `ROLLBACK`) counts as a write, so the read tier and `readOnly` requests are refused it. Details: TC-3035. - The 503 body of a request that reached its deadline before its write began reads "request_timeout: no change was applied; retry the request with a new signature". Details: TC-1997. diff --git a/docker-compose.dstack-postgres.yaml b/docker-compose.dstack-postgres.yaml index 6f08ac71..5b9440c9 100644 --- a/docker-compose.dstack-postgres.yaml +++ b/docker-compose.dstack-postgres.yaml @@ -209,7 +209,7 @@ services: environment: TINYCLOUD_LOGSHIP_PROFILE: ${TINYCLOUD_LOGSHIP_PROFILE:-errors_slow} BETTERSTACK_SOURCE_TOKEN: ${BETTERSTACK_SOURCE_TOKEN:?seal the node source token before enabling log shipping} - VECTOR_CONFIG_JSON: "{\"data_dir\":\"/var/lib/vector\",\"sources\":{\"gelf_in\":{\"type\":\"socket\",\"mode\":\"udp\",\"address\":\"0.0.0.0:12201\",\"max_length\":262144,\"receive_buffer_bytes\":8388608,\"framing\":{\"method\":\"chunked_gelf\",\"chunked_gelf\":{\"decompression\":\"Auto\"}},\"decoding\":{\"codec\":\"bytes\"}}},\"transforms\":{\"gelf_envelope\":{\"type\":\"remap\",\"inputs\":[\"gelf_in\"],\"source\":\"packet = string(.message) ?? \\\"\\\"\\nif length(packet) > 262144 {\\n . = {\\\"reason\\\": \\\"oversized\\\"}\\n} else {\\n outer, err = parse_json(packet)\\n if err != null || !is_object(outer) || (outer.version != \\\"1.1\\\" && outer.version != \\\"1.0\\\") {\\n . = {\\\"reason\\\": \\\"malformed_envelope\\\"}\\n } else if exists(outer.partial_message) || exists(outer._partial_message) {\\n . = {\\\"reason\\\": \\\"partial\\\"}\\n } else {\\n label = get(outer, [\\\"_tc.logship\\\"]) ?? null\\n . = {\\\"_tc.logship\\\": label, \\\"message\\\": outer.short_message}\\n }\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"logship_gate\":{\"type\":\"remap\",\"inputs\":[\"gelf_envelope\"],\"source\":\"if exists(.reason) {\\n . = {\\\"reason\\\": .reason}\\n} else {\\nlabel = string(get(., [\\\"_tc.logship\\\"]) ?? null) ?? \\\"\\\"\\nraw = .message\\nreason = \\\"\\\"\\nif label == \\\"\\\" { reason = \\\"unlabelled\\\" }\\nelse if !includes([\\\"tinycloud-node\\\", \\\"tinycloud-ingress\\\"], label) { reason = \\\"unexpected_label\\\" }\\nelse if exists(.partial_message) { reason = \\\"partial\\\" }\\nelse if !is_string(raw) { reason = \\\"malformed_envelope\\\" }\\nelse if length(string!(raw)) > 65536 { reason = \\\"oversized\\\" }\\nif reason != \\\"\\\" {\\n . = {\\\"reason\\\": reason}\\n} else {\\n parsed, err = parse_json(string!(raw))\\n if err != null || !is_object(parsed) { . = {\\\"reason\\\": \\\"non_json\\\"} }\\n else if exists(parsed.partial_message) { . = {\\\"reason\\\": \\\"partial\\\"} }\\n else {\\n target = string(parsed.target) ?? \\\"\\\"\\n level = downcase(string(parsed.level) ?? \\\"\\\")\\n if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && target != \\\"tinycloud\\\" && !starts_with(target, \\\"tinycloud::\\\") && target != \\\"tinycloud_core\\\" && !starts_with(target, \\\"tinycloud_core::\\\") {\\n . = {\\\"reason\\\": \\\"unknown_target\\\"}\\n } else if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && !((target == \\\"tinycloud::request\\\" || target == \\\"tinycloud::disk_headroom\\\" || target == \\\"tinycloud_core::models::delegation_mode\\\") && level == \\\"info\\\") {\\n . = {\\\"reason\\\": \\\"filtered_level\\\"}\\n } else { . = {\\\"label\\\": label, \\\"parsed\\\": parsed} }\\n }\\n}\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_route\":{\"type\":\"route\",\"inputs\":[\"logship_gate\"],\"route\":{\"candidate\":\"exists(.parsed)\",\"rejected\":\"exists(.reason)\"}},\"allowlist\":{\"type\":\"remap\",\"inputs\":[\"gate_route.candidate\"],\"source\":\"# Only this fresh object can leave the process boundary. No envelope, span,\\n# message, error, identity, URI or unknown key is copied into it.\\nj = .parsed\\nlabel = .label\\nout = {}\\nts = \\\"\\\"\\nif label == \\\"tinycloud-node\\\" {\\n target = string(j.target) ?? \\\"\\\"\\n level = downcase(string!(j.level))\\n f = object(j.fields) ?? {}\\n msg = string(f.message) ?? \\\"\\\"\\n ts = string!(j.timestamp)\\n # Literal Rocket template aliases only; never split an arbitrary URI.\\n aliases = {\\\"/attestation?\\\":\\\"/attestation\\\",\\\"/.well-known/encryption/network/?\\\":\\\"/.well-known/encryption/network/\\\",\\\"/hooks/events?\\\":\\\"/hooks/events\\\",\\\"/hooks/webhooks?\\\":\\\"/hooks/webhooks\\\",\\\"/public//kv?\\\":\\\"/public//kv\\\"}\\n # TC-1840: the node's one 5xx diagnostic line per database failure ships as an individual event.\\n # The input must carry exactly the declared keys (the message plus these seven, and db_hash only\\n # when it is a valid pseudonym) with exactly the declared types and enum values. Anything else\\n # leaves db_event null and the line falls back to the unclassified count below; no value of it\\n # is ever copied unless it passed, and the shipped object is built from literals and the\\n # validated values only.\\n db_event = null\\n if target == \\\"tinycloud::request\\\" && level == \\\"warn\\\" && msg == \\\"database failure answered with a 5xx\\\" {\\n db_status = f.status\\n db_elapsed = f.elapsed_ms\\n db_code = string(f.code) ?? \\\"\\\"\\n db_service = string(f.service) ?? \\\"\\\"\\n db_kind = string(f.failure_kind) ?? \\\"\\\"\\n db_route = string(f.route) ?? \\\"\\\"\\n db_canonical_route = get(aliases, [db_route]) ?? null\\n if is_string(db_canonical_route) { db_route = db_canonical_route }\\n db_ok = is_integer(db_status) && is_integer(db_elapsed) && is_boolean(f.write_may_have_applied)\\n if db_ok {\\n db_status = int!(db_status)\\n db_elapsed = int!(db_elapsed)\\n db_ok = db_status >= 500 && db_status <= 599 && db_elapsed >= 0 && db_elapsed <= 9007199254740991 && includes([\\\"unavailable_retryable\\\",\\\"outcome_unknown\\\",\\\"internal\\\",\\\"sql_busy\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\"], db_code) && includes([\\\"sql\\\",\\\"duckdb\\\",\\\"kv\\\",\\\"other\\\"], db_service) && includes([\\\"pool_timeout\\\",\\\"pool_closed\\\",\\\"io\\\",\\\"statement_timeout\\\",\\\"serialization\\\",\\\"connection_lost\\\",\\\"artifact_changed\\\",\\\"lock_wait\\\",\\\"hydration\\\",\\\"artifact_transfer\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\",\\\"other\\\"], db_kind) && includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], db_route)\\n }\\n db_hash = string(f.db_hash) ?? \\\"\\\"\\n has_db_hash = exists(f.db_hash)\\n if db_ok {\\n if has_db_hash { db_ok = match(db_hash, r'^[0-9a-f]{64}$') && length(f) == 9 } else { db_ok = length(f) == 8 }\\n }\\n if db_ok {\\n db_event = {\\\"event\\\": \\\"node_warning\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"warn\\\", \\\"event_code\\\": \\\"db_failure_5xx\\\", \\\"status\\\": db_status, \\\"code\\\": db_code, \\\"service\\\": db_service, \\\"route\\\": db_route, \\\"elapsed_ms\\\": db_elapsed, \\\"failure_kind\\\": db_kind, \\\"write_may_have_applied\\\": bool!(f.write_may_have_applied)}\\n if has_db_hash { db_event.db_hash = db_hash }\\n }\\n }\\n # TC-2917: the node's periodic disk headroom line (one per local store) ships as an individual\\n # info event. Exactly the message plus `store` (a declared store) and `free_bytes` (a bounded\\n # integer in whole 64 MiB steps, as the node rounds it); anything else leaves headroom null, and\\n # the info line is then dropped below.\\n headroom = null\\n if target == \\\"tinycloud::disk_headroom\\\" && level == \\\"info\\\" && msg == \\\"storage headroom\\\" && length(f) == 3 {\\n h_store = string(f.store) ?? \\\"\\\"\\n h_free = f.free_bytes\\n if includes([\\\"sql\\\",\\\"duckdb\\\"], h_store) && is_integer(h_free) {\\n h_free = int!(h_free)\\n if h_free >= 0 && h_free <= 9007199254740991 && mod(h_free, 67108864) == 0 {\\n headroom = {\\\"event\\\": \\\"node_storage_headroom\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"store\\\": h_store, \\\"free_bytes\\\": h_free}\\n }\\n }\\n }\\n # TC-3973: ship the boot summary with exactly the seven bounded counters.\\n backfill = null\\n if target == \\\"tinycloud_core::models::delegation_mode\\\" && level == \\\"info\\\" && length(f) == 8 {\\n backfill_code = get({\\\"delegation mode boot reindex complete\\\":\\\"delegation_mode_boot_reindex_complete\\\",\\\"delegation mode boot reindex incomplete; skipped rows remain unmarked and derive on read\\\":\\\"delegation_mode_boot_reindex_incomplete\\\",\\\"delegation mode boot reindex incomplete (lock timeout); remaining rows derive on read\\\":\\\"delegation_mode_boot_reindex_lock_timeout\\\"}, [msg]) ?? null\\n if is_string(backfill_code) {\\n counters = {}\\n for_each([\\\"scanned\\\", \\\"reindexed_terminal\\\", \\\"marked_attenuable\\\", \\\"marked_invalid\\\", \\\"skipped_locked_pages\\\", \\\"skipped_decrypt_failed\\\", \\\"elapsed_ms\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n counters = set!(counters, [field], value)\\n }\\n }\\n if length(counters) == 7 {\\n backfill = merge(counters, {\\\"event\\\": \\\"delegation_mode_boot_reindex\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"event_code\\\": backfill_code})\\n }\\n }\\n }\\n # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired\\n # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error\\n # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one\\n # of the ledger's fixed kinds. The message is never copied. Anything else leaves ledger null and the line falls back\\n # to the unclassified count below.\\n ledger = null\\n l_event = string(f.event) ?? \\\"\\\"\\n if level == \\\"error\\\" && includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], l_event) && exists(f.message) && length(f) == 3 {\\n l_target = get({\\\"deletion_ledger_open_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_replay_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_unrepaired\\\":\\\"tinycloud_core::encryption_network::deletion_ledger\\\"}, [l_event]) ?? \\\"\\\"\\n l_kind = string(f.error_kind) ?? \\\"\\\"\\n if target == l_target && includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], l_kind) {\\n ledger = {\\\"event\\\": l_event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"error\\\", \\\"error_kind\\\": l_kind}\\n }\\n }\\n if target == \\\"tinycloud::request\\\" && level == \\\"info\\\" && msg == \\\"request\\\" {\\n method = string!(f.method)\\n if includes([\\\"TRACE\\\", \\\"CONNECT\\\"], method) { method = \\\"\\\" }\\n route = string!(f.route)\\n canonical_route = get(aliases, [route]) ?? null\\n if is_string(canonical_route) { route = canonical_route }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = f.status\\n latency = f.latency_us\\n if !is_integer(status) || !is_integer(latency) { abort }\\n status = int!(status)\\n latency = int!(latency)\\n if status < 100 || status > 599 || latency < 0 || latency > 9007199254740991 { abort }\\n out = {\\\"event\\\": \\\"node_request\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"latency_us\\\": latency}\\n # N2 correlation fields: copied only when they have exactly the node's emitted shape; anything else is dropped\\n # (the event still ships). The pseudonyms are keyed HMAC-SHA256 digests, never raw identifiers.\\n rid = string(f.request_id) ?? \\\"\\\"\\n if match(rid, r'^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') { out.request_id = rid }\\n replaced = f.request_id_replaced\\n if is_boolean(replaced) { out.request_id_replaced = replaced }\\n account = string(f.account_hash) ?? \\\"\\\"\\n if match(account, r'^[0-9a-f]{64}$') { out.account_hash = account }\\n space = string(f.space_hash) ?? \\\"\\\"\\n if match(space, r'^[0-9a-f]{64}$') { out.space_hash = space }\\n # TC-3834: the 5xx origin, on status 500 and above only, and only when it is exactly one of the declared codes;\\n # anything else is dropped (the event still ships). A closed vocabulary, never error text.\\n if status >= 500 {\\n error_code = string(f.error_code) ?? \\\"\\\"\\n if includes([\\\"db_error\\\",\\\"db_timeout\\\",\\\"db_busy\\\",\\\"req_timeout\\\",\\\"read_audit\\\",\\\"storage_io\\\",\\\"caveat_db\\\",\\\"read_tx_error\\\",\\\"key_ledger\\\",\\\"lifecycle\\\",\\\"registry_down\\\",\\\"cutover_fence\\\",\\\"kv_candidate\\\",\\\"engine_error\\\",\\\"encryption\\\",\\\"size_limit\\\",\\\"disk_headroom\\\",\\\"internal\\\"], error_code) { out.error_code = error_code }\\n }\\n # TC-3739: per-request DB accounting, on status below 400 only (4xx/5xx are the capped classes; DB-caused 5xx\\n # already carry elapsed_ms on db_failure_5xx). Copied only as plain numbers inside the canonical bounds; anything\\n # else is dropped (the event still ships). They are driver wall times and an attempt count, never identifiers.\\n if status < 400 {\\n pool_wait = f.pool_wait_ms\\n if is_float(pool_wait) || is_integer(pool_wait) {\\n pool_wait = to_float!(pool_wait)\\n if pool_wait >= 0.0 && pool_wait <= 86400000.0 { out.pool_wait_ms = pool_wait }\\n }\\n query_time = f.query_time_ms\\n if is_float(query_time) || is_integer(query_time) {\\n query_time = to_float!(query_time)\\n if query_time >= 0.0 && query_time <= 86400000.0 { out.query_time_ms = query_time }\\n }\\n query_count = f.query_count\\n if is_integer(query_count) {\\n query_count = int!(query_count)\\n if query_count >= 0 && query_count <= 9007199254740991 { out.query_count = query_count }\\n }\\n }\\n } else if is_object(db_event) {\\n out = db_event\\n } else if is_object(headroom) {\\n out = headroom\\n } else if is_object(backfill) {\\n out = backfill\\n } else if is_object(ledger) {\\n out = ledger\\n } else {\\n if !includes([\\\"warn\\\", \\\"error\\\"], level) { abort }\\n code = \\\"unclassified\\\"\\n if target == \\\"tinycloud\\\" || starts_with(target, \\\"tinycloud::\\\") || target == \\\"tinycloud_core\\\" || starts_with(target, \\\"tinycloud_core::\\\") {\\n codes = {\\\"delegation mode boot backfill failed; unmarked rows derive on read\\\":\\\"delegation_mode_boot_backfill_failed\\\",\\\"delegation mode boot reindex skipped rows that failed decryption; leaving unmarked for read-time fail-closed handling\\\":\\\"delegation_mode_boot_reindex_decrypt_failed\\\",\\\"invocation replay insert failed\\\":\\\"invocation_replay_insert_failed\\\",\\\"invocation replay cleanup failed\\\":\\\"invocation_replay_cleanup_failed\\\",\\\"share-v2 local-tee feature active: deriving a deterministic, non-attested TEE identity from node key material\\\":\\\"share_local_tee_identity\\\",\\\"retention: delivered hook delivery prune failed\\\":\\\"retention_hook_delivery_prune_failed\\\",\\\"retention: dead-letter hook delivery prune failed\\\":\\\"retention_dead_letter_prune_failed\\\",\\\"retention: signed KV ticket prune failed\\\":\\\"retention_signed_ticket_prune_failed\\\",\\\"failed to load tunnel state; tunnel not started\\\":\\\"tunnel_state_load_failed\\\",\\\"invalid loopback API address; tunnel not started\\\":\\\"tunnel_address_invalid\\\",\\\"failed to load link state; LAN listener not started\\\":\\\"link_state_load_failed\\\",\\\"invalid link bind address; LAN listener not started\\\":\\\"link_bind_invalid\\\",\\\"invalid loopback API address; LAN listener not started\\\":\\\"link_address_invalid\\\",\\\"failed to bind link LAN listener; LAN listener not started\\\":\\\"link_bind_failed\\\",\\\"failed to build TLS config; LAN listener not started\\\":\\\"link_tls_config_failed\\\",\\\"link LAN listener exited with error\\\":\\\"link_listener_error\\\",\\\"failed to record link listener bind state\\\":\\\"link_listener_state_write_failed\\\",\\\"failed to record link listener bind failure\\\":\\\"link_bind_state_write_failed\\\",\\\"failed to load config for auto-renew\\\":\\\"link_auto_renew_config_failed\\\",\\\"link auto-renew failed\\\":\\\"link_auto_renew_failed\\\",\\\"failed to hot-reload renewed link cert\\\":\\\"link_cert_reload_failed\\\",\\\"link auto-renew succeeded but no state.json found; skipping cert hot-reload\\\":\\\"link_cert_state_missing\\\",\\\"failed to reload TLS material after link auto-renew\\\":\\\"link_listener_cert_reload_failed\\\",\\\"link disable: service delete failed; local state removed anyway\\\":\\\"link_disable_failed\\\",\\\"link connection error\\\":\\\"link_connection_error\\\",\\\"link listener accept error\\\":\\\"link_listener_accept_failed\\\",\\\"webhook delivery attempt failed\\\":\\\"webhook_delivery_failed\\\",\\\"webhook dispatcher loop failed\\\":\\\"webhook_dispatcher_failed\\\",\\\"addressed delegation authorization failed\\\":\\\"share_authorization_failed\\\",\\\"native share authorization denied\\\":\\\"share_native_authorization_denied\\\",\\\"native share KV put failed\\\":\\\"share_native_kv_put_failed\\\",\\\"share v2 readiness probe failed\\\":\\\"share_v2_readiness_failed\\\",\\\"share v2 is enabled but shareEmail.invitationPublicKey is unset\\\":\\\"share_invitation_key_missing\\\",\\\"configured share invitation key does not match the node's derived signing key\\\":\\\"share_invitation_key_mismatch\\\",\\\"share/v2 policy challenge denied\\\":\\\"share_policy_denied\\\",\\\"failed to read committed hook events\\\":\\\"hook_events_read_failed\\\",\\\"failed to load kv write hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"failed to load kv delete hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"missing committed kv hook row for invocation\\\":\\\"missing_committed_hook_row\\\",\\\"database write committed but webhook enqueue failed\\\":\\\"webhook_enqueue_failed\\\",\\\"tunnel: failed to prepare connection attempt\\\":\\\"tunnel_connection_prepare_failed\\\",\\\"tunnel: no frame within idle timeout; treating connection as dead\\\":\\\"tunnel_idle_timeout\\\",\\\"tunnel: read error\\\":\\\"tunnel_read_failed\\\",\\\"tunnel: dropping malformed frame\\\":\\\"tunnel_malformed_frame\\\",\\\"tunnel: relay sent an error frame\\\":\\\"tunnel_relay_error\\\",\\\"tunnel: failed to write frame\\\":\\\"tunnel_write_failed\\\",\\\"tunnel: failed to record runtime state\\\":\\\"tunnel_state_record_failed\\\",\\\"tunnel: failed to clear runtime state after disable\\\":\\\"tunnel_state_clear_failed\\\",\\\"tunnel authentication rejected\\\":\\\"tunnel_auth_rejected\\\",\\\"network DID resolution enabled: did:web/did:tz fetches use the unhardened ssi client (TC-1080)\\\":\\\"network_did_resolution_enabled\\\",\\\"SQL busy: lock wait\\\":\\\"sql_busy_lock_wait\\\",\\\"SQL busy: hydration\\\":\\\"sql_busy_hydration\\\",\\\"SQL busy: artifact transfer\\\":\\\"sql_busy_artifact_transfer\\\",\\\"Request deadline exceeded\\\":\\\"request_timeout\\\",\\\"Request completed after its deadline\\\":\\\"deadline_overrun\\\",\\\"Database hydration gave up loading its artifact\\\":\\\"sql_hydration_timeout\\\",\\\"Read audit wait expired\\\":\\\"read_audit_busy\\\",\\\"Read audit batch slow\\\":\\\"read_audit_batch_slow\\\",\\\"Read audit batch failed\\\":\\\"read_audit_batch_failed\\\",\\\"Read audit drain stalled\\\":\\\"read_audit_drain_stalled\\\",\\\"retrying operation after a lost database connection\\\":\\\"db_operation_retried\\\",\\\"not retrying operation: its first run took longer than the retry window to fail\\\":\\\"db_operation_retry_skipped_slow\\\",\\\"idx_current_kv_space_deleted_key_c is missing; the node keeps serving and KV list requests are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_current_kv_space_deleted_key_c)\\\":\\\"current_kv_c_index_missing\\\",\\\"idx_current_kv_space_deleted_key_c is invalid or still being built; the node keeps serving and KV list requests are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_invalid\\\",\\\"idx_current_kv_space_deleted_key_c exists with the wrong definition and is not used for KV lists; the node keeps serving and KV list requests are slower. Run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_wrong_shape\\\",\\\"idx_kv_write_space_value is missing; the node keeps serving and KV writes that attach a blob are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_kv_write_space_value)\\\":\\\"kv_write_value_index_missing\\\",\\\"idx_kv_write_space_value is invalid or still being built; the node keeps serving and KV writes that attach a blob are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_invalid\\\",\\\"idx_kv_write_space_value exists with the wrong definition and is not used for blob reference checks; the node keeps serving and KV writes that attach a blob are slower. Run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_wrong_shape\\\",\\\"request answered with a 5xx\\\":\\\"http_5xx\\\",\\\"chain guard wait exceeded the slow-wait threshold\\\":\\\"chain_guard_slow_wait\\\",\\\"kv head size probe failed; size omitted\\\":\\\"kv_head_size_probe_failed\\\",\\\"Database checkpoint save failed; refusing its writes until the back-off ends\\\":\\\"sql_checkpoint_save_backoff\\\",\\\"Database exceeds the artifact read limit; not loaded\\\":\\\"sql_database_too_large_to_load\\\",\\\"Database checkpoint exceeds the artifact write limit; not saved\\\":\\\"sql_checkpoint_too_large\\\",\\\"Database checkpoint shrank sharply against the artifact it replaces\\\":\\\"sql_checkpoint_shrank\\\",\\\"Database artifact storage unavailable\\\":\\\"sql_artifact_storage_unavailable\\\",\\\"Database artifact kept changing while it was read\\\":\\\"sql_artifact_changed_during_read\\\",\\\"Artifact part integrity check failed\\\":\\\"artifact_part_hash_mismatch\\\",\\\"Artifact part collection deferred\\\":\\\"artifact_part_collection_deferred\\\",\\\"Durable database artifact does not carry the expected file header; refusing to hydrate\\\":\\\"artifact_header_invalid\\\",\\\"No recorded artifact lineage for a live database; saving without a lineage assertion\\\":\\\"artifact_lineage_missing\\\",\\\"No recorded artifact lineage for a live database; discarding the actor\\\":\\\"artifact_lineage_missing_discarded\\\",\\\"Failed to open database\\\":\\\"database_open_failed\\\",\\\"Failed to promote database to file\\\":\\\"database_promote_failed\\\",\\\"Not enough free disk to promote a database; keeping it in memory\\\":\\\"database_promote_no_disk\\\",\\\"failed to copy view during table copy\\\":\\\"duckdb_view_copy_failed\\\",\\\"sql ddl allowed without schema ability (ddl_requires_schema = log)\\\":\\\"sql_ddl_without_schema\\\",\\\"Local SQL commit failed\\\":\\\"sql_commit_failed\\\",\\\"Dead SQL actor detected, respawning\\\":\\\"sql_actor_respawned\\\",\\\"Dead SQL actor detected during export, removing\\\":\\\"sql_actor_dead_on_export\\\",\\\"sql_store shadow upload blocked for a database\\\":\\\"shadow_upload_blocked\\\",\\\"sql_store shadow could not read a manifest row\\\":\\\"shadow_manifest_read_failed\\\",\\\"sql_store shadow lag scan failed\\\":\\\"shadow_lag_scan_failed\\\",\\\"sql_store shadow drained behind PG\\\":\\\"shadow_drained_behind_pg\\\",\\\"database connection lost\\\":\\\"db_connection_lost\\\",\\\"retries suppressed after a database overload signal\\\":\\\"db_retries_suppressed\\\",\\\"not retrying operation: retries are suppressed after a database overload signal\\\":\\\"db_operation_retry_suppressed\\\",\\\"not retrying operation: the request deadline leaves no room\\\":\\\"db_operation_retry_no_deadline\\\",\\\"retry attempt stopped: the operation budget expired\\\":\\\"db_operation_retry_budget_spent\\\",\\\"Read audit batch timed out\\\":\\\"read_audit_batch_timeout\\\",\\\"failed to refund orphaned KV blob; periodic collector will retry\\\":\\\"kv_blob_refund_failed\\\",\\\"a deleting fence named a blob that a committed write references; it was closed without deleting the blob\\\":\\\"kv_blob_delete_skipped_referenced\\\",\\\"KV orphan collection failed\\\":\\\"kv_orphan_collection_failed\\\",\\\"delegate epoch path failed\\\":\\\"delegate_epoch_path_failed\\\",\\\"epoch insert failed\\\":\\\"epoch_insert_failed\\\",\\\"epoch head backfill stopped at its first error; writes stay correct and repair each space on its next write\\\":\\\"epoch_head_backfill_failed\\\",\\\"invocation referenced a space absent from the database\\\":\\\"invocation_space_missing\\\",\\\"deletion ledger is locked by another process: waiting for it\\\":\\\"deletion_ledger_lock_wait\\\",\\\"deletion ledger replayed at start\\\":\\\"deletion_ledger_replayed\\\",\\\"deletion ledger: committed line was not written\\\":\\\"deletion_ledger_commit_unwritten\\\",\\\"deletion ledger: could not tell whether a delete committed; the operation stays open\\\":\\\"deletion_ledger_commit_unknown\\\",\\\"deletion ledger: the settling line was not written\\\":\\\"deletion_ledger_settle_unwritten\\\",\\\"could not record losing network create ceremony as failed\\\":\\\"network_create_ceremony_mark_failed\\\",\\\"share scope validation failed\\\":\\\"share_scope_validation_failed\\\",\\\"delivery authorization refused\\\":\\\"delivery_authorization_refused\\\",\\\"delivery authorizations refused by the rate limit\\\":\\\"delivery_rate_limited\\\",\\\"deactivated webhook subscriptions; owners must re-register\\\":\\\"hook_subscriptions_deactivated\\\",\\\"webhook egress closed: internal endpoint refresh failed\\\":\\\"webhook_egress_refresh_failed\\\",\\\"webhook egress closed: internal endpoint lookup failed\\\":\\\"webhook_egress_lookup_failed\\\",\\\"webhook delivery mark refused: lease no longer held\\\":\\\"webhook_mark_lease_lost\\\",\\\"webhook delivery lease release failed\\\":\\\"webhook_lease_release_failed\\\",\\\"webhook delivery send skipped: lease no longer held\\\":\\\"webhook_send_lease_lost\\\",\\\"internal renewal scheduler pass failed\\\":\\\"renewal_scheduler_tick_failed\\\",\\\"renewals paused node-wide\\\":\\\"renewals_paused\\\",\\\"renewals resumed node-wide\\\":\\\"renewals_resumed\\\",\\\"the links API clock differs from the node clock\\\":\\\"links_read_clock_skew\\\",\\\"purge ledger reconciliation failed; space traffic stays refused\\\":\\\"space_purge_reconcile_failed\\\",\\\"space purge residue sweep failed\\\":\\\"space_purge_sweep_failed\\\",\\\"space purge phase failed; retrying later\\\":\\\"space_purge_phase_failed\\\",\\\"space purge attempt release failed\\\":\\\"space_purge_release_failed\\\",\\\"space purge claim failed\\\":\\\"space_purge_claim_failed\\\",\\\"owner erasure pass failed; retrying later\\\":\\\"owner_erasure_pass_failed\\\",\\\"skipped invalid space directories while measuring storage\\\":\\\"storage_invalid_space_dirs\\\",\\\"removed setting is set and ignored; delete it from the configuration\\\":\\\"removed_setting_ignored\\\",\\\"admin stats result exceeds its bound\\\":\\\"admin_stats_over_bound\\\",\\\"admin stats query failed\\\":\\\"admin_stats_query_failed\\\",\\\"TDX quote unavailable\\\":\\\"attestation_quote_unavailable\\\",\\\"dstack guest agent returned an error\\\":\\\"dstack_guest_agent_error\\\",\\\"tunnel: failed to build upstream HTTP client\\\":\\\"tunnel_upstream_client_failed\\\"}\\n known = get(codes, [msg]) ?? null\\n if is_string(known) { code = known }\\n if starts_with(msg, \\\"quota service returned \\\") { code = \\\"quota_fallback\\\" }\\nif starts_with(msg, \\\"Failed to get TDX quote: \\\") { code = \\\"attestation_quote_failed\\\" }\\nif starts_with(msg, \\\"created a new node identity at \\\") { code = \\\"node_identity_created\\\" }\\nif starts_with(msg, \\\"quota service returned an invalid body: \\\") { code = \\\"quota_invalid_body\\\" }\\nif starts_with(msg, \\\"dstack socket available but get_info failed: \\\") { code = \\\"dstack_get_info_failed\\\" }\\n # TC-3284: a line with no message is named by its constant `event` field, only when that event is listed.\\n if msg == \\\"\\\" && !exists(f.message) {\\n events = {\\\"did_resolution_refused\\\":\\\"did_resolution_refused\\\",\\\"renewal_scheduler_lease_failed\\\":\\\"renewal_scheduler_lease_failed\\\",\\\"session_retire_failed\\\":\\\"session_retire_failed\\\"}\\n named = get(events, [string(f.event) ?? \\\"\\\"]) ?? null\\n if is_string(named) { code = named }\\n }\\n }\\n if level == \\\"warn\\\" && target == \\\"rocket::config::config\\\" && msg == \\\"found value for deprecated config key `log`\\\" { code = \\\"rocket_deprecated_log_config\\\" }\\nif level == \\\"warn\\\" && target == \\\"rocket::launch\\\" && starts_with(msg, \\\"Rocket has launched from \\\") { code = \\\"rocket_launched\\\" }\\n event = if level == \\\"warn\\\" { \\\"node_warning\\\" } else { \\\"node_error\\\" }\\n out = {\\\"event\\\": event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": level, \\\"event_code\\\": code, \\\"event_count\\\": 1}\\n }\\n} else {\\n ts = string!(j.time)\\n method = string!(j.method)\\n route = string!(j.route)\\n if route == \\\"\\\" { route = \\\"\\\" }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = j.status\\n request_time = j.request_time\\n if !is_integer(status) || !(is_integer(request_time) || is_float(request_time)) { abort }\\n status = int!(status)\\n request_time = to_float!(request_time)\\n if status < 100 || status > 599 || request_time < 0 || request_time > 86400 { abort }\\n out = {\\\"event\\\": \\\"ingress_request\\\", \\\"svc\\\": \\\"ingress\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"request_time_seconds\\\": request_time}\\n}\\nif length(ts) > 64 { abort }\\nparsed_ts = parse_timestamp!(ts, format: \\\"%+\\\")\\nout.ts = format_timestamp!(parsed_ts, format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\")\\n. = out\\n\",\"drop_on_error\":true,\"drop_on_abort\":true,\"reroute_dropped\":true},\"gate_counts\":{\"type\":\"remap\",\"inputs\":[\"gate_route.rejected\",\"gate_route._unmatched\",\"allowlist.dropped\",\"event_route._unmatched\"],\"source\":\"reason = .reason\\nif !includes([\\\"malformed_envelope\\\",\\\"unexpected_label\\\",\\\"unlabelled\\\",\\\"non_json\\\",\\\"oversized\\\",\\\"partial\\\",\\\"invalid_fields\\\",\\\"unknown_target\\\",\\\"filtered_level\\\"], reason) { reason = \\\"invalid_fields\\\" }\\n. = {\\\"reason\\\": reason, \\\"count\\\": 1}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_reduce\":{\"type\":\"reduce\",\"inputs\":[\"gate_counts\"],\"group_by\":[\"reason\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"count\":\"sum\"}},\"gate_output\":{\"type\":\"remap\",\"inputs\":[\"gate_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": \\\"warn\\\", \\\"event\\\": \\\"logship_gate_summary_total\\\", \\\"svc\\\": \\\"logship\\\", \\\"reason\\\": .reason, \\\"count\\\": .count}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"request_profile\":{\"type\":\"filter\",\"inputs\":[\"allowlist\"],\"condition\":\"\\\"$${TINYCLOUD_LOGSHIP_PROFILE}\\\" == \\\"all_requests\\\" || includes([\\\"node_warning\\\",\\\"node_error\\\",\\\"node_storage_headroom\\\",\\\"delegation_mode_boot_reindex\\\",\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event) || (int(.status) ?? 0) >= 400 || (.event == \\\"node_request\\\" && (int(.latency_us) ?? 0) > 1000000) || (.event == \\\"ingress_request\\\" && (to_float(.request_time_seconds) ?? 0.0) > 1.000000)\"},\"event_route\":{\"type\":\"route\",\"inputs\":[\"request_profile\"],\"route\":{\"request\":\"(.event == \\\"node_request\\\" || .event == \\\"ingress_request\\\") && !(((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)) && !((int(.status) ?? 0) >= 500)\",\"node_request_5xx\":\".event == \\\"node_request\\\" && (int(.status) ?? 0) >= 500\",\"ingress_request_5xx\":\".event == \\\"ingress_request\\\" && (int(.status) ?? 0) >= 500\",\"node_request_4xx\":\".event == \\\"node_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"ingress_request_4xx\":\".event == \\\"ingress_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"db_failure_5xx\":\".event == \\\"node_warning\\\" && .event_code == \\\"db_failure_5xx\\\"\",\"storage_headroom\":\".event == \\\"node_storage_headroom\\\"\",\"delegation_mode_boot_reindex\":\".event == \\\"delegation_mode_boot_reindex\\\"\",\"deletion_ledger\":\"includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event)\",\"diagnostic\":\"(.event == \\\"node_warning\\\" && .event_code != \\\"db_failure_5xx\\\") || .event == \\\"node_error\\\"\"}},\"cap_db_failure_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.db_failure_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"db_failure_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"diagnostic_reduce\":{\"type\":\"reduce\",\"inputs\":[\"event_route.diagnostic\"],\"group_by\":[\"event\",\"event_code\",\"level\",\"svc\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"event_count\":\"sum\",\"ts\":\"discard\"}},\"diagnostic_output\":{\"type\":\"remap\",\"inputs\":[\"diagnostic_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": .level, \\\"event\\\": .event, \\\"svc\\\": \\\"api\\\", \\\"event_code\\\": .event_code, \\\"event_count\\\": .event_count}\",\"drop_on_error\":true,\"drop_on_abort\":true}},\"sinks\":{\"betterstack\":{\"type\":\"http\",\"inputs\":[\"event_route.request\",\"event_route.storage_headroom\",\"event_route.delegation_mode_boot_reindex\",\"event_route.deletion_ledger\",\"cap_db_failure_5xx\",\"cap_node_request_5xx\",\"cap_ingress_request_5xx\",\"cap_node_request_4xx\",\"cap_ingress_request_4xx\",\"diagnostic_output\",\"gate_output\"],\"method\":\"post\",\"uri\":\"https://s2795437.us-west-2a.betterstackdata.com/\",\"encoding\":{\"codec\":\"json\"},\"framing\":{\"method\":\"newline_delimited\"},\"compression\":\"gzip\",\"auth\":{\"strategy\":\"bearer\",\"token\":\"SECRET[bs.bs_token]\"},\"batch\":{\"max_bytes\":262144,\"timeout_secs\":1},\"buffer\":{\"type\":\"memory\",\"max_events\":1000,\"when_full\":\"block\"},\"request\":{\"timeout_secs\":10,\"retry_max_duration_secs\":300},\"healthcheck\":{\"enabled\":false}}},\"secret\":{\"bs\":{\"type\":\"directory\",\"path\":\"/var/lib/vector/secrets\",\"remove_trailing_whitespace\":true}}}" + VECTOR_CONFIG_JSON: "{\"data_dir\":\"/var/lib/vector\",\"sources\":{\"gelf_in\":{\"type\":\"socket\",\"mode\":\"udp\",\"address\":\"0.0.0.0:12201\",\"max_length\":262144,\"receive_buffer_bytes\":8388608,\"framing\":{\"method\":\"chunked_gelf\",\"chunked_gelf\":{\"decompression\":\"Auto\"}},\"decoding\":{\"codec\":\"bytes\"}}},\"transforms\":{\"gelf_envelope\":{\"type\":\"remap\",\"inputs\":[\"gelf_in\"],\"source\":\"packet = string(.message) ?? \\\"\\\"\\nif length(packet) > 262144 {\\n . = {\\\"reason\\\": \\\"oversized\\\"}\\n} else {\\n outer, err = parse_json(packet)\\n if err != null || !is_object(outer) || (outer.version != \\\"1.1\\\" && outer.version != \\\"1.0\\\") {\\n . = {\\\"reason\\\": \\\"malformed_envelope\\\"}\\n } else if exists(outer.partial_message) || exists(outer._partial_message) {\\n . = {\\\"reason\\\": \\\"partial\\\"}\\n } else {\\n label = get(outer, [\\\"_tc.logship\\\"]) ?? null\\n . = {\\\"_tc.logship\\\": label, \\\"message\\\": outer.short_message}\\n }\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"logship_gate\":{\"type\":\"remap\",\"inputs\":[\"gelf_envelope\"],\"source\":\"if exists(.reason) {\\n . = {\\\"reason\\\": .reason}\\n} else {\\nlabel = string(get(., [\\\"_tc.logship\\\"]) ?? null) ?? \\\"\\\"\\nraw = .message\\nreason = \\\"\\\"\\nif label == \\\"\\\" { reason = \\\"unlabelled\\\" }\\nelse if !includes([\\\"tinycloud-node\\\", \\\"tinycloud-ingress\\\"], label) { reason = \\\"unexpected_label\\\" }\\nelse if exists(.partial_message) { reason = \\\"partial\\\" }\\nelse if !is_string(raw) { reason = \\\"malformed_envelope\\\" }\\nelse if length(string!(raw)) > 65536 { reason = \\\"oversized\\\" }\\nif reason != \\\"\\\" {\\n . = {\\\"reason\\\": reason}\\n} else {\\n parsed, err = parse_json(string!(raw))\\n if err != null || !is_object(parsed) { . = {\\\"reason\\\": \\\"non_json\\\"} }\\n else if exists(parsed.partial_message) { . = {\\\"reason\\\": \\\"partial\\\"} }\\n else {\\n target = string(parsed.target) ?? \\\"\\\"\\n level = downcase(string(parsed.level) ?? \\\"\\\")\\n gate_fields = object(parsed.fields) ?? {}\\n gate_event = string(gate_fields.event) ?? \\\"\\\"\\n if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && target != \\\"tinycloud\\\" && !starts_with(target, \\\"tinycloud::\\\") && target != \\\"tinycloud_core\\\" && !starts_with(target, \\\"tinycloud_core::\\\") {\\n . = {\\\"reason\\\": \\\"unknown_target\\\"}\\n } else if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && !((target == \\\"tinycloud::request\\\" || target == \\\"tinycloud::disk_headroom\\\" || target == \\\"tinycloud_core::models::delegation_mode\\\" || (target == \\\"tinycloud\\\" && gate_event == \\\"deletion_ledger_start\\\")) && level == \\\"info\\\") {\\n . = {\\\"reason\\\": \\\"filtered_level\\\"}\\n } else { . = {\\\"label\\\": label, \\\"parsed\\\": parsed} }\\n }\\n}\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_route\":{\"type\":\"route\",\"inputs\":[\"logship_gate\"],\"route\":{\"candidate\":\"exists(.parsed)\",\"rejected\":\"exists(.reason)\"}},\"allowlist\":{\"type\":\"remap\",\"inputs\":[\"gate_route.candidate\"],\"source\":\"# Only this fresh object can leave the process boundary. No envelope, span,\\n# message, error, identity, URI or unknown key is copied into it.\\nj = .parsed\\nlabel = .label\\nout = {}\\nts = \\\"\\\"\\nif label == \\\"tinycloud-node\\\" {\\n target = string(j.target) ?? \\\"\\\"\\n level = downcase(string!(j.level))\\n f = object(j.fields) ?? {}\\n msg = string(f.message) ?? \\\"\\\"\\n ts = string!(j.timestamp)\\n # Literal Rocket template aliases only; never split an arbitrary URI.\\n aliases = {\\\"/attestation?\\\":\\\"/attestation\\\",\\\"/.well-known/encryption/network/?\\\":\\\"/.well-known/encryption/network/\\\",\\\"/hooks/events?\\\":\\\"/hooks/events\\\",\\\"/hooks/webhooks?\\\":\\\"/hooks/webhooks\\\",\\\"/public//kv?\\\":\\\"/public//kv\\\"}\\n # TC-1840: the node's one 5xx diagnostic line per database failure ships as an individual event.\\n # The input must carry exactly the declared keys (the message plus these seven, and db_hash only\\n # when it is a valid pseudonym) with exactly the declared types and enum values. Anything else\\n # leaves db_event null and the line falls back to the unclassified count below; no value of it\\n # is ever copied unless it passed, and the shipped object is built from literals and the\\n # validated values only.\\n db_event = null\\n if target == \\\"tinycloud::request\\\" && level == \\\"warn\\\" && msg == \\\"database failure answered with a 5xx\\\" {\\n db_status = f.status\\n db_elapsed = f.elapsed_ms\\n db_code = string(f.code) ?? \\\"\\\"\\n db_service = string(f.service) ?? \\\"\\\"\\n db_kind = string(f.failure_kind) ?? \\\"\\\"\\n db_route = string(f.route) ?? \\\"\\\"\\n db_canonical_route = get(aliases, [db_route]) ?? null\\n if is_string(db_canonical_route) { db_route = db_canonical_route }\\n db_ok = is_integer(db_status) && is_integer(db_elapsed) && is_boolean(f.write_may_have_applied)\\n if db_ok {\\n db_status = int!(db_status)\\n db_elapsed = int!(db_elapsed)\\n db_ok = db_status >= 500 && db_status <= 599 && db_elapsed >= 0 && db_elapsed <= 9007199254740991 && includes([\\\"unavailable_retryable\\\",\\\"outcome_unknown\\\",\\\"internal\\\",\\\"sql_busy\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\"], db_code) && includes([\\\"sql\\\",\\\"duckdb\\\",\\\"kv\\\",\\\"other\\\"], db_service) && includes([\\\"pool_timeout\\\",\\\"pool_closed\\\",\\\"io\\\",\\\"statement_timeout\\\",\\\"serialization\\\",\\\"connection_lost\\\",\\\"artifact_changed\\\",\\\"lock_wait\\\",\\\"hydration\\\",\\\"artifact_transfer\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\",\\\"other\\\"], db_kind) && includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], db_route)\\n }\\n db_hash = string(f.db_hash) ?? \\\"\\\"\\n has_db_hash = exists(f.db_hash)\\n if db_ok {\\n if has_db_hash { db_ok = match(db_hash, r'^[0-9a-f]{64}$') && length(f) == 9 } else { db_ok = length(f) == 8 }\\n }\\n if db_ok {\\n db_event = {\\\"event\\\": \\\"node_warning\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"warn\\\", \\\"event_code\\\": \\\"db_failure_5xx\\\", \\\"status\\\": db_status, \\\"code\\\": db_code, \\\"service\\\": db_service, \\\"route\\\": db_route, \\\"elapsed_ms\\\": db_elapsed, \\\"failure_kind\\\": db_kind, \\\"write_may_have_applied\\\": bool!(f.write_may_have_applied)}\\n if has_db_hash { db_event.db_hash = db_hash }\\n }\\n }\\n # TC-2917: the node's periodic disk headroom line (one per local store) ships as an individual\\n # info event. Exactly the message plus `store` (a declared store) and `free_bytes` (a bounded\\n # integer in whole 64 MiB steps, as the node rounds it); anything else leaves headroom null, and\\n # the info line is then dropped below.\\n headroom = null\\n if target == \\\"tinycloud::disk_headroom\\\" && level == \\\"info\\\" && msg == \\\"storage headroom\\\" && length(f) == 3 {\\n h_store = string(f.store) ?? \\\"\\\"\\n h_free = f.free_bytes\\n if includes([\\\"sql\\\",\\\"duckdb\\\"], h_store) && is_integer(h_free) {\\n h_free = int!(h_free)\\n if h_free >= 0 && h_free <= 9007199254740991 && mod(h_free, 67108864) == 0 {\\n headroom = {\\\"event\\\": \\\"node_storage_headroom\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"store\\\": h_store, \\\"free_bytes\\\": h_free}\\n }\\n }\\n }\\n # TC-3973: ship the boot summary with exactly the seven bounded counters.\\n backfill = null\\n if target == \\\"tinycloud_core::models::delegation_mode\\\" && level == \\\"info\\\" && length(f) == 8 {\\n backfill_code = get({\\\"delegation mode boot reindex complete\\\":\\\"delegation_mode_boot_reindex_complete\\\",\\\"delegation mode boot reindex incomplete; skipped rows remain unmarked and derive on read\\\":\\\"delegation_mode_boot_reindex_incomplete\\\",\\\"delegation mode boot reindex incomplete (lock timeout); remaining rows derive on read\\\":\\\"delegation_mode_boot_reindex_lock_timeout\\\"}, [msg]) ?? null\\n if is_string(backfill_code) {\\n counters = {}\\n for_each([\\\"scanned\\\", \\\"reindexed_terminal\\\", \\\"marked_attenuable\\\", \\\"marked_invalid\\\", \\\"skipped_locked_pages\\\", \\\"skipped_decrypt_failed\\\", \\\"elapsed_ms\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n counters = set!(counters, [field], value)\\n }\\n }\\n if length(counters) == 7 {\\n backfill = merge(counters, {\\\"event\\\": \\\"delegation_mode_boot_reindex\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"event_code\\\": backfill_code})\\n }\\n }\\n }\\n # TC-4177: the deletion ledger's one line per start (target `tinycloud`, info) ships as an individual event. Either the\\n # message plus exactly `event`, `ledger_file` (a declared state), five bounded integer counts and `newest_deleted_at`\\n # (`none` or an RFC 3339 instant: digits, `T`, `:`, `.`, `Z`, `+`, `-` only), or the failure message plus exactly\\n # `event` and an `error_kind` from the ledger's fixed kinds. The message is never copied. Anything else leaves\\n # ledger_start null and the info line is dropped below.\\n ledger_start = null\\n if target == \\\"tinycloud\\\" && level == \\\"info\\\" && (string(f.event) ?? \\\"\\\") == \\\"deletion_ledger_start\\\" {\\n if msg == \\\"deletion ledger at start\\\" && length(f) == 9 {\\n ls_file = string(f.ledger_file) ?? \\\"\\\"\\n ls_newest = string(f.newest_deleted_at) ?? \\\"\\\"\\n if includes([\\\"missing\\\",\\\"empty\\\",\\\"present\\\"], ls_file) && match(ls_newest, r'^(none|\\\\d{4}-\\\\d{2}-\\\\d{2}[Tt]\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d{1,9})?([Zz]|[+-]\\\\d{2}:\\\\d{2}))$') {\\n ls_counts = {}\\n for_each([\\\"bytes\\\",\\\"operations\\\",\\\"key_entries\\\",\\\"committed\\\",\\\"aborted\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n ls_counts = set!(ls_counts, [field], value)\\n }\\n }\\n if length(ls_counts) == 5 {\\n ledger_start = merge(ls_counts, {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"ledger_file\\\": ls_file, \\\"newest_deleted_at\\\": ls_newest})\\n }\\n }\\n } else if msg == \\\"deletion ledger counts unavailable at start\\\" && length(f) == 3 {\\n ls_kind = string(f.error_kind) ?? \\\"\\\"\\n if includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], ls_kind) {\\n ledger_start = {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"error_kind\\\": ls_kind}\\n }\\n }\\n }\\n # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired\\n # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error\\n # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one\\n # of the ledger's fixed kinds. The message is never copied. Anything else leaves ledger null and the line falls back\\n # to the unclassified count below.\\n ledger = null\\n l_event = string(f.event) ?? \\\"\\\"\\n if level == \\\"error\\\" && includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], l_event) && exists(f.message) && length(f) == 3 {\\n l_target = get({\\\"deletion_ledger_open_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_replay_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_unrepaired\\\":\\\"tinycloud_core::encryption_network::deletion_ledger\\\"}, [l_event]) ?? \\\"\\\"\\n l_kind = string(f.error_kind) ?? \\\"\\\"\\n if target == l_target && includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], l_kind) {\\n ledger = {\\\"event\\\": l_event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"error\\\", \\\"error_kind\\\": l_kind}\\n }\\n }\\n if target == \\\"tinycloud::request\\\" && level == \\\"info\\\" && msg == \\\"request\\\" {\\n method = string!(f.method)\\n if includes([\\\"TRACE\\\", \\\"CONNECT\\\"], method) { method = \\\"\\\" }\\n route = string!(f.route)\\n canonical_route = get(aliases, [route]) ?? null\\n if is_string(canonical_route) { route = canonical_route }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = f.status\\n latency = f.latency_us\\n if !is_integer(status) || !is_integer(latency) { abort }\\n status = int!(status)\\n latency = int!(latency)\\n if status < 100 || status > 599 || latency < 0 || latency > 9007199254740991 { abort }\\n out = {\\\"event\\\": \\\"node_request\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"latency_us\\\": latency}\\n # N2 correlation fields: copied only when they have exactly the node's emitted shape; anything else is dropped\\n # (the event still ships). The pseudonyms are keyed HMAC-SHA256 digests, never raw identifiers.\\n rid = string(f.request_id) ?? \\\"\\\"\\n if match(rid, r'^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') { out.request_id = rid }\\n replaced = f.request_id_replaced\\n if is_boolean(replaced) { out.request_id_replaced = replaced }\\n account = string(f.account_hash) ?? \\\"\\\"\\n if match(account, r'^[0-9a-f]{64}$') { out.account_hash = account }\\n space = string(f.space_hash) ?? \\\"\\\"\\n if match(space, r'^[0-9a-f]{64}$') { out.space_hash = space }\\n # TC-3834: the 5xx origin, on status 500 and above only, and only when it is exactly one of the declared codes;\\n # anything else is dropped (the event still ships). A closed vocabulary, never error text.\\n if status >= 500 {\\n error_code = string(f.error_code) ?? \\\"\\\"\\n if includes([\\\"db_error\\\",\\\"db_timeout\\\",\\\"db_busy\\\",\\\"req_timeout\\\",\\\"read_audit\\\",\\\"storage_io\\\",\\\"caveat_db\\\",\\\"read_tx_error\\\",\\\"key_ledger\\\",\\\"lifecycle\\\",\\\"registry_down\\\",\\\"cutover_fence\\\",\\\"kv_candidate\\\",\\\"engine_error\\\",\\\"encryption\\\",\\\"size_limit\\\",\\\"disk_headroom\\\",\\\"internal\\\"], error_code) { out.error_code = error_code }\\n }\\n # TC-3739: per-request DB accounting, on status below 400 only (4xx/5xx are the capped classes; DB-caused 5xx\\n # already carry elapsed_ms on db_failure_5xx). Copied only as plain numbers inside the canonical bounds; anything\\n # else is dropped (the event still ships). They are driver wall times and an attempt count, never identifiers.\\n if status < 400 {\\n pool_wait = f.pool_wait_ms\\n if is_float(pool_wait) || is_integer(pool_wait) {\\n pool_wait = to_float!(pool_wait)\\n if pool_wait >= 0.0 && pool_wait <= 86400000.0 { out.pool_wait_ms = pool_wait }\\n }\\n query_time = f.query_time_ms\\n if is_float(query_time) || is_integer(query_time) {\\n query_time = to_float!(query_time)\\n if query_time >= 0.0 && query_time <= 86400000.0 { out.query_time_ms = query_time }\\n }\\n query_count = f.query_count\\n if is_integer(query_count) {\\n query_count = int!(query_count)\\n if query_count >= 0 && query_count <= 9007199254740991 { out.query_count = query_count }\\n }\\n }\\n } else if is_object(db_event) {\\n out = db_event\\n } else if is_object(headroom) {\\n out = headroom\\n } else if is_object(backfill) {\\n out = backfill\\n } else if is_object(ledger_start) {\\n out = ledger_start\\n } else if is_object(ledger) {\\n out = ledger\\n } else {\\n if !includes([\\\"warn\\\", \\\"error\\\"], level) { abort }\\n code = \\\"unclassified\\\"\\n if target == \\\"tinycloud\\\" || starts_with(target, \\\"tinycloud::\\\") || target == \\\"tinycloud_core\\\" || starts_with(target, \\\"tinycloud_core::\\\") {\\n codes = {\\\"delegation mode boot backfill failed; unmarked rows derive on read\\\":\\\"delegation_mode_boot_backfill_failed\\\",\\\"delegation mode boot reindex skipped rows that failed decryption; leaving unmarked for read-time fail-closed handling\\\":\\\"delegation_mode_boot_reindex_decrypt_failed\\\",\\\"invocation replay insert failed\\\":\\\"invocation_replay_insert_failed\\\",\\\"invocation replay cleanup failed\\\":\\\"invocation_replay_cleanup_failed\\\",\\\"share-v2 local-tee feature active: deriving a deterministic, non-attested TEE identity from node key material\\\":\\\"share_local_tee_identity\\\",\\\"retention: delivered hook delivery prune failed\\\":\\\"retention_hook_delivery_prune_failed\\\",\\\"retention: dead-letter hook delivery prune failed\\\":\\\"retention_dead_letter_prune_failed\\\",\\\"retention: signed KV ticket prune failed\\\":\\\"retention_signed_ticket_prune_failed\\\",\\\"failed to load tunnel state; tunnel not started\\\":\\\"tunnel_state_load_failed\\\",\\\"invalid loopback API address; tunnel not started\\\":\\\"tunnel_address_invalid\\\",\\\"failed to load link state; LAN listener not started\\\":\\\"link_state_load_failed\\\",\\\"invalid link bind address; LAN listener not started\\\":\\\"link_bind_invalid\\\",\\\"invalid loopback API address; LAN listener not started\\\":\\\"link_address_invalid\\\",\\\"failed to bind link LAN listener; LAN listener not started\\\":\\\"link_bind_failed\\\",\\\"failed to build TLS config; LAN listener not started\\\":\\\"link_tls_config_failed\\\",\\\"link LAN listener exited with error\\\":\\\"link_listener_error\\\",\\\"failed to record link listener bind state\\\":\\\"link_listener_state_write_failed\\\",\\\"failed to record link listener bind failure\\\":\\\"link_bind_state_write_failed\\\",\\\"failed to load config for auto-renew\\\":\\\"link_auto_renew_config_failed\\\",\\\"link auto-renew failed\\\":\\\"link_auto_renew_failed\\\",\\\"failed to hot-reload renewed link cert\\\":\\\"link_cert_reload_failed\\\",\\\"link auto-renew succeeded but no state.json found; skipping cert hot-reload\\\":\\\"link_cert_state_missing\\\",\\\"failed to reload TLS material after link auto-renew\\\":\\\"link_listener_cert_reload_failed\\\",\\\"link disable: service delete failed; local state removed anyway\\\":\\\"link_disable_failed\\\",\\\"link connection error\\\":\\\"link_connection_error\\\",\\\"link listener accept error\\\":\\\"link_listener_accept_failed\\\",\\\"webhook delivery attempt failed\\\":\\\"webhook_delivery_failed\\\",\\\"webhook dispatcher loop failed\\\":\\\"webhook_dispatcher_failed\\\",\\\"addressed delegation authorization failed\\\":\\\"share_authorization_failed\\\",\\\"native share authorization denied\\\":\\\"share_native_authorization_denied\\\",\\\"native share KV put failed\\\":\\\"share_native_kv_put_failed\\\",\\\"share v2 readiness probe failed\\\":\\\"share_v2_readiness_failed\\\",\\\"share v2 is enabled but shareEmail.invitationPublicKey is unset\\\":\\\"share_invitation_key_missing\\\",\\\"configured share invitation key does not match the node's derived signing key\\\":\\\"share_invitation_key_mismatch\\\",\\\"share/v2 policy challenge denied\\\":\\\"share_policy_denied\\\",\\\"failed to read committed hook events\\\":\\\"hook_events_read_failed\\\",\\\"failed to load kv write hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"failed to load kv delete hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"missing committed kv hook row for invocation\\\":\\\"missing_committed_hook_row\\\",\\\"database write committed but webhook enqueue failed\\\":\\\"webhook_enqueue_failed\\\",\\\"tunnel: failed to prepare connection attempt\\\":\\\"tunnel_connection_prepare_failed\\\",\\\"tunnel: no frame within idle timeout; treating connection as dead\\\":\\\"tunnel_idle_timeout\\\",\\\"tunnel: read error\\\":\\\"tunnel_read_failed\\\",\\\"tunnel: dropping malformed frame\\\":\\\"tunnel_malformed_frame\\\",\\\"tunnel: relay sent an error frame\\\":\\\"tunnel_relay_error\\\",\\\"tunnel: failed to write frame\\\":\\\"tunnel_write_failed\\\",\\\"tunnel: failed to record runtime state\\\":\\\"tunnel_state_record_failed\\\",\\\"tunnel: failed to clear runtime state after disable\\\":\\\"tunnel_state_clear_failed\\\",\\\"tunnel authentication rejected\\\":\\\"tunnel_auth_rejected\\\",\\\"network DID resolution enabled: did:web/did:tz fetches use the unhardened ssi client (TC-1080)\\\":\\\"network_did_resolution_enabled\\\",\\\"SQL busy: lock wait\\\":\\\"sql_busy_lock_wait\\\",\\\"SQL busy: hydration\\\":\\\"sql_busy_hydration\\\",\\\"SQL busy: artifact transfer\\\":\\\"sql_busy_artifact_transfer\\\",\\\"Request deadline exceeded\\\":\\\"request_timeout\\\",\\\"Request completed after its deadline\\\":\\\"deadline_overrun\\\",\\\"Database hydration gave up loading its artifact\\\":\\\"sql_hydration_timeout\\\",\\\"Read audit wait expired\\\":\\\"read_audit_busy\\\",\\\"Read audit batch slow\\\":\\\"read_audit_batch_slow\\\",\\\"Read audit batch failed\\\":\\\"read_audit_batch_failed\\\",\\\"Read audit drain stalled\\\":\\\"read_audit_drain_stalled\\\",\\\"retrying operation after a lost database connection\\\":\\\"db_operation_retried\\\",\\\"not retrying operation: its first run took longer than the retry window to fail\\\":\\\"db_operation_retry_skipped_slow\\\",\\\"idx_current_kv_space_deleted_key_c is missing; the node keeps serving and KV list requests are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_current_kv_space_deleted_key_c)\\\":\\\"current_kv_c_index_missing\\\",\\\"idx_current_kv_space_deleted_key_c is invalid or still being built; the node keeps serving and KV list requests are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_invalid\\\",\\\"idx_current_kv_space_deleted_key_c exists with the wrong definition and is not used for KV lists; the node keeps serving and KV list requests are slower. Run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_wrong_shape\\\",\\\"idx_kv_write_space_value is missing; the node keeps serving and KV writes that attach a blob are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_kv_write_space_value)\\\":\\\"kv_write_value_index_missing\\\",\\\"idx_kv_write_space_value is invalid or still being built; the node keeps serving and KV writes that attach a blob are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_invalid\\\",\\\"idx_kv_write_space_value exists with the wrong definition and is not used for blob reference checks; the node keeps serving and KV writes that attach a blob are slower. Run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_wrong_shape\\\",\\\"request answered with a 5xx\\\":\\\"http_5xx\\\",\\\"chain guard wait exceeded the slow-wait threshold\\\":\\\"chain_guard_slow_wait\\\",\\\"kv head size probe failed; size omitted\\\":\\\"kv_head_size_probe_failed\\\",\\\"Database checkpoint save failed; refusing its writes until the back-off ends\\\":\\\"sql_checkpoint_save_backoff\\\",\\\"Database exceeds the artifact read limit; not loaded\\\":\\\"sql_database_too_large_to_load\\\",\\\"Database checkpoint exceeds the artifact write limit; not saved\\\":\\\"sql_checkpoint_too_large\\\",\\\"Database checkpoint shrank sharply against the artifact it replaces\\\":\\\"sql_checkpoint_shrank\\\",\\\"Database artifact storage unavailable\\\":\\\"sql_artifact_storage_unavailable\\\",\\\"Database artifact kept changing while it was read\\\":\\\"sql_artifact_changed_during_read\\\",\\\"Artifact part integrity check failed\\\":\\\"artifact_part_hash_mismatch\\\",\\\"Artifact part collection deferred\\\":\\\"artifact_part_collection_deferred\\\",\\\"Durable database artifact does not carry the expected file header; refusing to hydrate\\\":\\\"artifact_header_invalid\\\",\\\"No recorded artifact lineage for a live database; saving without a lineage assertion\\\":\\\"artifact_lineage_missing\\\",\\\"No recorded artifact lineage for a live database; discarding the actor\\\":\\\"artifact_lineage_missing_discarded\\\",\\\"Failed to open database\\\":\\\"database_open_failed\\\",\\\"Failed to promote database to file\\\":\\\"database_promote_failed\\\",\\\"Not enough free disk to promote a database; keeping it in memory\\\":\\\"database_promote_no_disk\\\",\\\"failed to copy view during table copy\\\":\\\"duckdb_view_copy_failed\\\",\\\"Database cache cleanup failed\\\":\\\"duckdb_cache_cleanup_failed\\\",\\\"sql ddl allowed without schema ability (ddl_requires_schema = log)\\\":\\\"sql_ddl_without_schema\\\",\\\"Local SQL commit failed\\\":\\\"sql_commit_failed\\\",\\\"Dead SQL actor detected, respawning\\\":\\\"sql_actor_respawned\\\",\\\"Dead SQL actor detected during export, removing\\\":\\\"sql_actor_dead_on_export\\\",\\\"sql_store shadow upload blocked for a database\\\":\\\"shadow_upload_blocked\\\",\\\"sql_store shadow could not read a manifest row\\\":\\\"shadow_manifest_read_failed\\\",\\\"sql_store shadow lag scan failed\\\":\\\"shadow_lag_scan_failed\\\",\\\"sql_store shadow drained behind PG\\\":\\\"shadow_drained_behind_pg\\\",\\\"database connection lost\\\":\\\"db_connection_lost\\\",\\\"retries suppressed after a database overload signal\\\":\\\"db_retries_suppressed\\\",\\\"not retrying operation: retries are suppressed after a database overload signal\\\":\\\"db_operation_retry_suppressed\\\",\\\"not retrying operation: the request deadline leaves no room\\\":\\\"db_operation_retry_no_deadline\\\",\\\"retry attempt stopped: the operation budget expired\\\":\\\"db_operation_retry_budget_spent\\\",\\\"Read audit batch timed out\\\":\\\"read_audit_batch_timeout\\\",\\\"failed to refund orphaned KV blob; periodic collector will retry\\\":\\\"kv_blob_refund_failed\\\",\\\"a deleting fence named a blob that a committed write references; it was closed without deleting the blob\\\":\\\"kv_blob_delete_skipped_referenced\\\",\\\"KV orphan collection failed\\\":\\\"kv_orphan_collection_failed\\\",\\\"delegate epoch path failed\\\":\\\"delegate_epoch_path_failed\\\",\\\"epoch insert failed\\\":\\\"epoch_insert_failed\\\",\\\"epoch head backfill stopped at its first error; writes stay correct and repair each space on its next write\\\":\\\"epoch_head_backfill_failed\\\",\\\"invocation referenced a space absent from the database\\\":\\\"invocation_space_missing\\\",\\\"deletion ledger is locked by another process: waiting for it\\\":\\\"deletion_ledger_lock_wait\\\",\\\"deletion ledger replayed at start\\\":\\\"deletion_ledger_replayed\\\",\\\"deletion ledger: committed line was not written\\\":\\\"deletion_ledger_commit_unwritten\\\",\\\"deletion ledger: could not tell whether a delete committed; the operation stays open\\\":\\\"deletion_ledger_commit_unknown\\\",\\\"deletion ledger: the settling line was not written\\\":\\\"deletion_ledger_settle_unwritten\\\",\\\"could not record losing network create ceremony as failed\\\":\\\"network_create_ceremony_mark_failed\\\",\\\"share scope validation failed\\\":\\\"share_scope_validation_failed\\\",\\\"delivery authorization refused\\\":\\\"delivery_authorization_refused\\\",\\\"delivery authorizations refused by the rate limit\\\":\\\"delivery_rate_limited\\\",\\\"deactivated webhook subscriptions; owners must re-register\\\":\\\"hook_subscriptions_deactivated\\\",\\\"webhook egress closed: internal endpoint refresh failed\\\":\\\"webhook_egress_refresh_failed\\\",\\\"webhook egress closed: internal endpoint lookup failed\\\":\\\"webhook_egress_lookup_failed\\\",\\\"webhook delivery mark refused: lease no longer held\\\":\\\"webhook_mark_lease_lost\\\",\\\"webhook delivery lease release failed\\\":\\\"webhook_lease_release_failed\\\",\\\"webhook delivery send skipped: lease no longer held\\\":\\\"webhook_send_lease_lost\\\",\\\"internal renewal scheduler pass failed\\\":\\\"renewal_scheduler_tick_failed\\\",\\\"renewals paused node-wide\\\":\\\"renewals_paused\\\",\\\"renewals resumed node-wide\\\":\\\"renewals_resumed\\\",\\\"the links API clock differs from the node clock\\\":\\\"links_read_clock_skew\\\",\\\"purge ledger reconciliation failed; space traffic stays refused\\\":\\\"space_purge_reconcile_failed\\\",\\\"space purge residue sweep failed\\\":\\\"space_purge_sweep_failed\\\",\\\"space purge phase failed; retrying later\\\":\\\"space_purge_phase_failed\\\",\\\"space purge attempt release failed\\\":\\\"space_purge_release_failed\\\",\\\"space purge claim failed\\\":\\\"space_purge_claim_failed\\\",\\\"owner erasure pass failed; retrying later\\\":\\\"owner_erasure_pass_failed\\\",\\\"skipped invalid space directories while measuring storage\\\":\\\"storage_invalid_space_dirs\\\",\\\"removed setting is set and ignored; delete it from the configuration\\\":\\\"removed_setting_ignored\\\",\\\"admin stats result exceeds its bound\\\":\\\"admin_stats_over_bound\\\",\\\"admin stats query failed\\\":\\\"admin_stats_query_failed\\\",\\\"TDX quote unavailable\\\":\\\"attestation_quote_unavailable\\\",\\\"dstack guest agent returned an error\\\":\\\"dstack_guest_agent_error\\\",\\\"tunnel: failed to build upstream HTTP client\\\":\\\"tunnel_upstream_client_failed\\\"}\\n known = get(codes, [msg]) ?? null\\n if is_string(known) { code = known }\\n if starts_with(msg, \\\"quota service returned \\\") { code = \\\"quota_fallback\\\" }\\nif starts_with(msg, \\\"Failed to get TDX quote: \\\") { code = \\\"attestation_quote_failed\\\" }\\nif starts_with(msg, \\\"created a new node identity at \\\") { code = \\\"node_identity_created\\\" }\\nif starts_with(msg, \\\"quota service returned an invalid body: \\\") { code = \\\"quota_invalid_body\\\" }\\nif starts_with(msg, \\\"dstack socket available but get_info failed: \\\") { code = \\\"dstack_get_info_failed\\\" }\\n # TC-3284: a line with no message is named by its constant `event` field, only when that event is listed.\\n if msg == \\\"\\\" && !exists(f.message) {\\n events = {\\\"did_resolution_refused\\\":\\\"did_resolution_refused\\\",\\\"renewal_scheduler_lease_failed\\\":\\\"renewal_scheduler_lease_failed\\\",\\\"session_retire_failed\\\":\\\"session_retire_failed\\\"}\\n named = get(events, [string(f.event) ?? \\\"\\\"]) ?? null\\n if is_string(named) { code = named }\\n }\\n }\\n if level == \\\"warn\\\" && target == \\\"rocket::config::config\\\" && msg == \\\"found value for deprecated config key `log`\\\" { code = \\\"rocket_deprecated_log_config\\\" }\\nif level == \\\"warn\\\" && target == \\\"rocket::launch\\\" && starts_with(msg, \\\"Rocket has launched from \\\") { code = \\\"rocket_launched\\\" }\\n event = if level == \\\"warn\\\" { \\\"node_warning\\\" } else { \\\"node_error\\\" }\\n out = {\\\"event\\\": event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": level, \\\"event_code\\\": code, \\\"event_count\\\": 1}\\n }\\n} else {\\n ts = string!(j.time)\\n method = string!(j.method)\\n route = string!(j.route)\\n if route == \\\"\\\" { route = \\\"\\\" }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = j.status\\n request_time = j.request_time\\n if !is_integer(status) || !(is_integer(request_time) || is_float(request_time)) { abort }\\n status = int!(status)\\n request_time = to_float!(request_time)\\n if status < 100 || status > 599 || request_time < 0 || request_time > 86400 { abort }\\n out = {\\\"event\\\": \\\"ingress_request\\\", \\\"svc\\\": \\\"ingress\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"request_time_seconds\\\": request_time}\\n}\\nif length(ts) > 64 { abort }\\nparsed_ts = parse_timestamp!(ts, format: \\\"%+\\\")\\nout.ts = format_timestamp!(parsed_ts, format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\")\\n. = out\\n\",\"drop_on_error\":true,\"drop_on_abort\":true,\"reroute_dropped\":true},\"gate_counts\":{\"type\":\"remap\",\"inputs\":[\"gate_route.rejected\",\"gate_route._unmatched\",\"allowlist.dropped\",\"event_route._unmatched\"],\"source\":\"reason = .reason\\nif !includes([\\\"malformed_envelope\\\",\\\"unexpected_label\\\",\\\"unlabelled\\\",\\\"non_json\\\",\\\"oversized\\\",\\\"partial\\\",\\\"invalid_fields\\\",\\\"unknown_target\\\",\\\"filtered_level\\\"], reason) { reason = \\\"invalid_fields\\\" }\\n. = {\\\"reason\\\": reason, \\\"count\\\": 1}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_reduce\":{\"type\":\"reduce\",\"inputs\":[\"gate_counts\"],\"group_by\":[\"reason\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"count\":\"sum\"}},\"gate_output\":{\"type\":\"remap\",\"inputs\":[\"gate_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": \\\"warn\\\", \\\"event\\\": \\\"logship_gate_summary_total\\\", \\\"svc\\\": \\\"logship\\\", \\\"reason\\\": .reason, \\\"count\\\": .count}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"request_profile\":{\"type\":\"filter\",\"inputs\":[\"allowlist\"],\"condition\":\"\\\"$${TINYCLOUD_LOGSHIP_PROFILE}\\\" == \\\"all_requests\\\" || includes([\\\"node_warning\\\",\\\"node_error\\\",\\\"node_storage_headroom\\\",\\\"delegation_mode_boot_reindex\\\",\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\",\\\"deletion_ledger_start\\\"], .event) || (int(.status) ?? 0) >= 400 || (.event == \\\"node_request\\\" && (int(.latency_us) ?? 0) > 1000000) || (.event == \\\"ingress_request\\\" && (to_float(.request_time_seconds) ?? 0.0) > 1.000000)\"},\"event_route\":{\"type\":\"route\",\"inputs\":[\"request_profile\"],\"route\":{\"request\":\"(.event == \\\"node_request\\\" || .event == \\\"ingress_request\\\") && !(((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)) && !((int(.status) ?? 0) >= 500)\",\"node_request_5xx\":\".event == \\\"node_request\\\" && (int(.status) ?? 0) >= 500\",\"ingress_request_5xx\":\".event == \\\"ingress_request\\\" && (int(.status) ?? 0) >= 500\",\"node_request_4xx\":\".event == \\\"node_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"ingress_request_4xx\":\".event == \\\"ingress_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"db_failure_5xx\":\".event == \\\"node_warning\\\" && .event_code == \\\"db_failure_5xx\\\"\",\"storage_headroom\":\".event == \\\"node_storage_headroom\\\"\",\"delegation_mode_boot_reindex\":\".event == \\\"delegation_mode_boot_reindex\\\"\",\"deletion_ledger\":\"includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event)\",\"deletion_ledger_start\":\".event == \\\"deletion_ledger_start\\\"\",\"diagnostic\":\"(.event == \\\"node_warning\\\" && .event_code != \\\"db_failure_5xx\\\") || .event == \\\"node_error\\\"\"}},\"cap_db_failure_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.db_failure_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"db_failure_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"diagnostic_reduce\":{\"type\":\"reduce\",\"inputs\":[\"event_route.diagnostic\"],\"group_by\":[\"event\",\"event_code\",\"level\",\"svc\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"event_count\":\"sum\",\"ts\":\"discard\"}},\"diagnostic_output\":{\"type\":\"remap\",\"inputs\":[\"diagnostic_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": .level, \\\"event\\\": .event, \\\"svc\\\": \\\"api\\\", \\\"event_code\\\": .event_code, \\\"event_count\\\": .event_count}\",\"drop_on_error\":true,\"drop_on_abort\":true}},\"sinks\":{\"betterstack\":{\"type\":\"http\",\"inputs\":[\"event_route.request\",\"event_route.storage_headroom\",\"event_route.delegation_mode_boot_reindex\",\"event_route.deletion_ledger\",\"event_route.deletion_ledger_start\",\"cap_db_failure_5xx\",\"cap_node_request_5xx\",\"cap_ingress_request_5xx\",\"cap_node_request_4xx\",\"cap_ingress_request_4xx\",\"diagnostic_output\",\"gate_output\"],\"method\":\"post\",\"uri\":\"https://s2795437.us-west-2a.betterstackdata.com/\",\"encoding\":{\"codec\":\"json\"},\"framing\":{\"method\":\"newline_delimited\"},\"compression\":\"gzip\",\"auth\":{\"strategy\":\"bearer\",\"token\":\"SECRET[bs.bs_token]\"},\"batch\":{\"max_bytes\":262144,\"timeout_secs\":1},\"buffer\":{\"type\":\"memory\",\"max_events\":1000,\"when_full\":\"block\"},\"request\":{\"timeout_secs\":10,\"retry_max_duration_secs\":300},\"healthcheck\":{\"enabled\":false}}},\"secret\":{\"bs\":{\"type\":\"directory\",\"path\":\"/var/lib/vector/secrets\",\"remove_trailing_whitespace\":true}}}" entrypoint: - /bin/sh - -ec diff --git a/docs/releasing.md b/docs/releasing.md index 94cc3e1c..1da41008 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -731,7 +731,8 @@ Before any CVM mutation the workflow requires: - the main compose, with its one node digest replaced by 64 zeros, to hash to the reviewed N0 template - **`8c8785fbc80e2dc16358abe0304cec32235367c9b9cfc5e1776704f7019af4f8`** + **`0d9f299592c7abeac31a425982f71be30e24122c6d75881588e169417bb0f296`** + (raw `70b3ee6ea659f01d52630764f5b9e379733655e149340e98ef6cfa4ad97bf2ce` normalized). Before the TC-4177 deletion ledger start line (`deletion_ledger_start`) and the TC-4190 `duckdb_cache_cleanup_failed` code in the Vector config the template was `8c8785fbc80e2dc16358abe0304cec32235367c9b9cfc5e1776704f7019af4f8` (raw `7cc95bde531f100148a8bbcc8a8d104144d75e382873362dd6fb76b88403f27e` normalized). Before TC-3973 startup diagnostics and reindex counts in the Vector config the template was `e0f99bcca6f220c65d81cad15504790099d634243ea701350a509e995b672aa0` (raw `a8fb25f7c3608cbf69911d054825fd4dd0da0a9a78fc5c8ff7701bf346693b6b` normalized). Before the TC-3284 named node diagnostics (every node warning and error message mapped to its own `event_code`) in the Vector config the template was `97a180a43ec70c7950e717417c5455b13ede1a3adab5a196f65b5aa21dcc5271` (raw `bced82d3f0e975c176cf35b72cea0bc26c9aa4acf5212304b946c068db1d6394` normalized); before the TC-3284 deletion ledger error events (`deletion_ledger_open_failed`, `deletion_ledger_replay_failed`, `deletion_ledger_unrepaired`) in the Vector config the template was `db348152c6b7a03beb42373299400b35bc0badf8b188988d9406192b4b88a540` @@ -946,8 +947,8 @@ gh workflow run docker.yml -R TinyCloudLabs/tinycloud-node --ref main \ The served/OCI identity remains **1.20.6-dstack / e18578ff9162986ddd813259c60f73866e3e60d1**. With the template lock on main this redeploys exactly main's raw compose -`7cc95bde531f100148a8bbcc8a8d104144d75e382873362dd6fb76b88403f27e` -(the 1.21.0 compose `d95bfb70…` with the TC-1274, TC-1317, TC-1482, `current_kv_c_index_*`, `db_failure_5xx`, the 4xx and 5xx caps, `errors_dropped`, TC-2346 `db_operation_retried` / `db_operation_retry_skipped_slow`, TC-2917 `node_storage_headroom`, TC-3739 `node_request` DB timing, TC-3834 `node_request` `error_code`, TC-3284 deletion ledger error event and TC-3284 named node diagnostics and TC-3973 startup events in the Vector config, the optional TC-1482 `NODE_STATS_READ_TOKEN` env line, the TC-950 pool of 10, the TC-1777 `NAMED_KEYS_V1` gate env lines with the `deletion-ledger` volume, the TC-1491 artifact read limit env line, the TC-3554 `TINYCLOUD_KEYS__TYPE: DstackKmsEpoch` pins with no key-recovery sidecar, the TC-287 `TINYCLOUD_RETENTION__ENABLED: "true"` env line, the TC-1791 `TINYCLOUD_SQL__DELEGATED_CAVEATS_ENFORCED: "true"` env line and the TC-1491 `TINYCLOUD_STORAGE__SQL__MAX_DATABASE_BYTES: "320 MiB"` / `MIN_FREE_BYTES: "1 GiB"` env lines), whatever digest +`70b3ee6ea659f01d52630764f5b9e379733655e149340e98ef6cfa4ad97bf2ce` +(the 1.21.0 compose `d95bfb70…` with the TC-1274, TC-1317, TC-1482, `current_kv_c_index_*`, `db_failure_5xx`, the 4xx and 5xx caps, `errors_dropped`, TC-2346 `db_operation_retried` / `db_operation_retry_skipped_slow`, TC-2917 `node_storage_headroom`, TC-3739 `node_request` DB timing, TC-3834 `node_request` `error_code`, TC-3284 deletion ledger error event and TC-3284 named node diagnostics and TC-3973 startup events and TC-4177 `deletion_ledger_start` and TC-4190 `duckdb_cache_cleanup_failed` in the Vector config, the optional TC-1482 `NODE_STATS_READ_TOKEN` env line, the TC-950 pool of 10, the TC-1777 `NAMED_KEYS_V1` gate env lines with the `deletion-ledger` volume, the TC-1491 artifact read limit env line, the TC-3554 `TINYCLOUD_KEYS__TYPE: DstackKmsEpoch` pins with no key-recovery sidecar, the TC-287 `TINYCLOUD_RETENTION__ENABLED: "true"` env line, the TC-1791 `TINYCLOUD_SQL__DELEGATED_CAVEATS_ENFORCED: "true"` env line and the TC-1491 `TINYCLOUD_STORAGE__SQL__MAX_DATABASE_BYTES: "320 MiB"` / `MIN_FREE_BYTES: "1 GiB"` env lines), whatever digest main's template currently pins. **Since TC-3554 only 1.26.15 or later boots on this compose, and only once the database holds the `root_wrap` blob:** 1.26.14 needs the sidecar this compose lacks, diff --git a/log-shipper/canonical.json b/log-shipper/canonical.json index 37dbdc63..dd96a983 100644 --- a/log-shipper/canonical.json +++ b/log-shipper/canonical.json @@ -1,6 +1,6 @@ { "repo": "samgbafa/tinycloud-dev", - "revision": "2079e2bf01c5f2cb0c24c190819821891d395af9", + "revision": "ab0c591b282664485c17d77ad10a27cbc0ed2bba", "path": "ops/logging/fields.json", - "sha256": "c3ff3d3e87ac1192a5eadfdc6376ab21d84685771e678073669acc0465d22ee8" + "sha256": "4143ff5019de70af6ceedca0e895f82bb5b3acccbcfd93d7667b84e4210d1653" } diff --git a/log-shipper/cases.mjs b/log-shipper/cases.mjs index cd733179..9db10304 100644 --- a/log-shipper/cases.mjs +++ b/log-shipper/cases.mjs @@ -1,6 +1,6 @@ // Synthetic inputs only. Native Vector evaluates every assertion after the full boundary. import { CAPPED_CLASSES } from './budget.mjs'; -import { LEDGER_EVENTS, LEDGER_ERROR_KINDS, LEDGER_TARGETS } from './ledger.mjs'; +import { LEDGER_EVENTS, LEDGER_ERROR_KINDS, LEDGER_TARGETS, LEDGER_START_EVENT, LEDGER_START_TARGET, LEDGER_START_MESSAGE, LEDGER_START_FAILED_MESSAGE, LEDGER_START_FILES } from './ledger.mjs'; export const canary = 'TC959_SYNTHETIC_Bearer_eyJhbGciOiJub25lIn0.email@example.test.did:pkh:0xdeadbeef'; export const timestamp = '2026-10-16T12:00:00.000Z'; export const nodeRequest = (fields = {}) => ({ timestamp, level: 'INFO', target: 'tinycloud::request', fields: { message: 'request', method: 'POST', route: '/invoke', status: 200, latency_us: 1234, ...fields } }); @@ -59,6 +59,15 @@ const ledgerShipped = ['error_kind', 'event', 'level', 'svc', 'ts']; const ledgerUnclassified = `.event == "node_error" && .event_code == "unclassified" && .event_count == 1 && !exists(.error_kind) && ${keysAre(['event', 'event_code', 'event_count', 'level', 'svc', 'ts'])}`; // Like reject(), and the drop is counted under exactly `reason`. const rejectFor = (name, input, reason) => ({ name, inputs: [{ insert_at: 'logship_gate', type: 'log', log_fields: logFields(input) }], no_outputs_from: ['allowlist'], outputs: [{ extract_from: 'gate_counts', conditions: [{ type: 'vrl', source: `assert!(.count == 1 && .reason == "${reason}")\nassert!(!contains(encode_json(.), "TC959_SYNTHETIC"))` }] }] }); +// TC-4177: the node's deletion ledger start line (`log_deletion_ledger_start`, tinycloud-node-server/src/lib.rs) and its +// failure variant, as the node emits them. `ledger_file` is LedgerFileState::as_str(); `newest_deleted_at` is `none` or the +// latest intent instant as written. Nothing here is an id, key path or file path. +const ledgerStartCounts = { bytes: 4096, operations: 12, key_entries: 40, committed: 10, aborted: 1 }; +const ledgerStartNewest = '2026-11-23T08:15:30.123456789Z'; +export const ledgerStart = (fields = {}, extra = {}) => ({ timestamp, level: 'INFO', target: LEDGER_START_TARGET, ...extra, fields: { message: LEDGER_START_MESSAGE, event: LEDGER_START_EVENT, ledger_file: 'present', ...ledgerStartCounts, newest_deleted_at: ledgerStartNewest, ...fields } }); +export const ledgerStartFailed = (fields = {}, extra = {}) => ({ timestamp, level: 'INFO', target: LEDGER_START_TARGET, ...extra, fields: { message: LEDGER_START_FAILED_MESSAGE, event: LEDGER_START_EVENT, error_kind: 'io', ...fields } }); +const ledgerStartShipped = ['aborted', 'bytes', 'committed', 'event', 'key_entries', 'ledger_file', 'level', 'newest_deleted_at', 'operations', 'svc', 'ts']; +const ledgerStartFailedShipped = ['error_kind', 'event', 'level', 'svc', 'ts']; // TC-1843: per-window caps. Each capped class has its own route and `lua` cap transform. Events are injected at // event_route (the post-sanitize shape) so the route and the cap both run. A Vector test condition is met by any one // event, so exact membership is pinned by expected_event_count plus one condition per sequence number. @@ -183,6 +192,9 @@ export const vectorTests = [ // TC-3284: every node warn/error message is mapped (coverage.test.mjs). A message-less line is named by its constant `event` // field only when diagnostics.json lists that event; its other fields and any unlisted event stay out. ...[['deletion ledger is locked by another process: waiting for it', 'WARN', 'node_warning', 'deletion_ledger_lock_wait'], ['Database artifact kept changing while it was read', 'WARN', 'node_warning', 'sql_artifact_changed_during_read'], ['purge ledger reconciliation failed; space traffic stays refused', 'ERROR', 'node_error', 'space_purge_reconcile_failed']].map(([message, level, event, code]) => check(`node message "${message}" maps to ${code} with only the fixed diagnostic keys`, envelope({ timestamp, level, target: 'tinycloud_core::x', fields: { message, event: canary, error: canary, lease_cid: canary } }), `.event == "${event}" && .event_code == "${code}" && .event_count == 1 && ${keysAre(unclassifiedKeys)}`)), + // TC-4190: the DuckDB cache cleanup warning (tinycloud-core/src/duckdb/database.rs) is named by its exact message and ships only the code. + check('Database cache cleanup failed maps to duckdb_cache_cleanup_failed with only the fixed diagnostic keys', envelope({ timestamp, level: 'WARN', target: 'tinycloud_core::duckdb::database', fields: { message: 'Database cache cleanup failed', event: 'duckdb_cache_cleanup_failed', path: canary } }), `.event == "node_warning" && .event_code == "duckdb_cache_cleanup_failed" && .event_count == 1 && ${keysAre(unclassifiedKeys)}`), + check('a near-miss of the DuckDB cache cleanup message stays unclassified', envelope({ timestamp, level: 'WARN', target: 'tinycloud_core::duckdb::database', fields: { message: 'Database cache cleanup failed: x', event: 'duckdb_cache_cleanup_failed' } }), `.event == "node_warning" && .event_code == "unclassified" && .event_count == 1 && ${keysAre(unclassifiedKeys)}`), check('node format message maps by its constant prefix and drops the formatted value', envelope({ timestamp, level: 'WARN', target: 'tinycloud::node_control::key_provider', fields: { message: `created a new node identity at /data/${canary} (did:key:${canary})` } }), `.event == "node_warning" && .event_code == "node_identity_created" && .event_count == 1 && ${keysAre(unclassifiedKeys)}`), ...['renewal_scheduler_lease_failed', 'session_retire_failed', 'did_resolution_refused'].map(name => check(`message-less node warning named by its listed event ${name} ships only the code`, envelope({ timestamp, level: 'WARN', target: 'tinycloud::renewal', fields: { event: name, lease_cid: canary, host: canary, reason: canary } }), `.event == "node_warning" && .event_code == "${name}" && .event_count == 1 && ${keysAre(unclassifiedKeys)}`)), check('message-less node warning with an unlisted event stays unclassified', envelope({ timestamp, level: 'WARN', target: 'tinycloud::renewal', fields: { event: canary, lease_cid: canary } }), `.event == "node_warning" && .event_code == "unclassified" && .event_count == 1 && ${keysAre(unclassifiedKeys)}`), @@ -239,6 +251,37 @@ export const vectorTests = [ ...LEDGER_EVENTS.map(event => check(`${event} at warn level is a plain unclassified warning`, envelope(ledgerError(event, {}, { level: 'WARN' })), `.event == "node_warning" && .event_code == "unclassified" && !exists(.error_kind) && ${keysAre(['event', 'event_code', 'event_count', 'level', 'svc', 'ts'])}`)), ...LEDGER_EVENTS.flatMap(event => ['tinycloud::request', 'tinycloud_core', 'tinycloud_core::encryption_network', LEDGER_TARGETS[event] === 'tinycloud' ? 'tinycloud_core::encryption_network::deletion_ledger' : 'tinycloud'].map(target => check(`${event} from target ${target} is never shipped as a ledger event`, envelope(ledgerError(event, {}, { target })), ledgerUnclassified))), check('a dependency cannot borrow a ledger event name', envelope(ledgerError('deletion_ledger_open_failed', {}, { target: 'dependency' })), ledgerUnclassified), + // TC-4177: the deletion ledger's one line per start ships as an individual info event with its counts. Each case below + // runs the node's own line (target `tinycloud`, message and fields as `log_deletion_ledger_start` emits them). + ...LEDGER_START_FILES.map(file => check(`${LEDGER_START_EVENT} with a ${file} ledger file ships its file state, counts and newest instant`, envelope(ledgerStart({ ledger_file: file })), `.event == "${LEDGER_START_EVENT}" && .svc == "api" && .level == "info" && .ledger_file == "${file}" && ${Object.entries(ledgerStartCounts).map(([key, value]) => `.${key} == ${value}`).join(' && ')} && .newest_deleted_at == "${ledgerStartNewest}" && ${keysAre(ledgerStartShipped)}`)), + check(`${LEDGER_START_EVENT} for an empty ledger ships zero counts and no newest instant`, envelope(ledgerStart({ ledger_file: 'empty', bytes: 0, operations: 0, key_entries: 0, committed: 0, aborted: 0, newest_deleted_at: 'none' })), `.event == "${LEDGER_START_EVENT}" && .ledger_file == "empty" && .bytes == 0 && .operations == 0 && .key_entries == 0 && .committed == 0 && .aborted == 0 && .newest_deleted_at == "none" && ${keysAre(ledgerStartShipped)}`), + check(`${LEDGER_START_EVENT} ships the largest count the schema allows`, envelope(ledgerStart({ operations: 9007199254740991 })), `.event == "${LEDGER_START_EVENT}" && .operations == 9007199254740991 && ${keysAre(ledgerStartShipped)}`), + ...['2026-11-23T08:15:30Z', '2026-11-23T08:15:30.5Z', '2026-11-23T08:15:30.123456789+01:00', '2026-11-23t08:15:30-05:30'].map(instant => check(`${LEDGER_START_EVENT} ships the newest instant ${instant} as written`, envelope(ledgerStart({ newest_deleted_at: instant })), `.event == "${LEDGER_START_EVENT}" && .newest_deleted_at == "${instant}" && ${keysAre(ledgerStartShipped)}`)), + check(`${LEDGER_START_EVENT} failure variant ships only its fixed error_kind`, envelope(ledgerStartFailed()), `.event == "${LEDGER_START_EVENT}" && .svc == "api" && .level == "info" && .error_kind == "io" && ${keysAre(ledgerStartFailedShipped)}`), + ...LEDGER_ERROR_KINDS.map(kind => check(`${LEDGER_START_EVENT} failure variant ships error_kind ${kind}`, envelope(ledgerStartFailed({ error_kind: kind })), `.event == "${LEDGER_START_EVENT}" && .error_kind == "${kind}" && ${keysAre(ledgerStartFailedShipped)}`)), + ...[ + ['a negative count', { bytes: -1 }], ['a string count', { operations: '12' }], ['a fractional count', { key_entries: 0.5 }], + ['an oversized count', { committed: 9007199254740992 }], ['a null count', { aborted: null }], ['a missing count', { aborted: undefined }], + ['an unlisted file state', { ledger_file: 'lost' }], ['an upper-case file state', { ledger_file: 'PRESENT' }], ['a free-text file state', { ledger_file: canary }], ['a missing file state', { ledger_file: undefined }], + ['a free-text newest instant', { newest_deleted_at: canary }], ['an empty newest instant', { newest_deleted_at: '' }], ['a date-only newest instant', { newest_deleted_at: '2026-11-23' }], + ['a newest instant with trailing text', { newest_deleted_at: `2026-11-23T08:15:30Z ${canary}` }], ['a numeric newest instant', { newest_deleted_at: 20261123 }], ['a missing newest instant', { newest_deleted_at: undefined }], + ['an extra path field', { path: '/var/lib/tinycloud/ledger/deletions.jsonl' }], ['an extra key field', { key: canary }], ['a torn_tail field', { torn_tail: false }], + ['an unlisted message', { message: canary }], ['a missing message', { message: undefined }], ['the failure message with the counts', { message: LEDGER_START_FAILED_MESSAGE }], + ['a different event name', { event: 'deletion_ledger_opened' }], + ].map(([label, fields]) => rejectFor(`${LEDGER_START_EVENT} with ${label} is dropped`, envelope(ledgerStart(fields)), 'event' in fields ? 'filtered_level' : 'invalid_fields')), + ...[ + ['an unlisted kind', { error_kind: 'xyz' }], ['a path as kind', { error_kind: '/var/lib/tinycloud/ledger/deletions.jsonl' }], ['a free-text kind', { error_kind: canary }], + ['a missing kind', { error_kind: undefined }], ['an extra count field', { bytes: 4096 }], ['an unlisted message', { message: canary }], ['the success message', { message: LEDGER_START_MESSAGE }], + ].map(([label, fields]) => rejectFor(`${LEDGER_START_EVENT} failure variant with ${label} is dropped`, envelope(ledgerStartFailed(fields)), 'invalid_fields')), + ...[ + ['tinycloud::request', 'invalid_fields'], ['tinycloud::disk_headroom', 'invalid_fields'], ['tinycloud::runtime', 'filtered_level'], ['tinycloud_core', 'filtered_level'], + ['tinycloud_core::encryption_network::deletion_ledger', 'filtered_level'], ['tinycloud_core::models::delegation_mode', 'invalid_fields'], ['dependency', 'unknown_target'], + ].map(([target, reason]) => rejectFor(`${LEDGER_START_EVENT} from target ${target} is never shipped as the start event`, envelope(ledgerStart({}, { target })), reason)), + ...[['an unrelated info line on the node target', { message: canary, event: undefined, ledger_file: undefined, bytes: undefined, operations: undefined, key_entries: undefined, committed: undefined, aborted: undefined, newest_deleted_at: undefined }], ['an info line naming another ledger event', { event: 'deletion_ledger_open_failed' }], ['an info line naming no event', { event: undefined }]] + .map(([label, fields]) => rejectFor(`${label} on target tinycloud is dropped at the gate`, envelope(ledgerStart(fields)), 'filtered_level')), + check(`${LEDGER_START_EVENT} at warn level is a plain unclassified warning`, envelope(ledgerStart({}, { level: 'WARN' })), `.event == "node_warning" && .event_code == "unclassified" && .event_count == 1 && !exists(.bytes) && !exists(.ledger_file) && ${keysAre(unclassifiedKeys)}`), + check(`${LEDGER_START_EVENT} at error level is a plain unclassified error`, envelope(ledgerStart({}, { level: 'ERROR' })), `.event == "node_error" && .event_code == "unclassified" && .event_count == 1 && !exists(.bytes) && ${keysAre(unclassifiedKeys)}`), + check(`a dependency cannot borrow the ${LEDGER_START_EVENT} event`, envelope(ledgerStart({}, { target: 'dependency', level: 'WARN' })), `.event == "node_warning" && .event_code == "unclassified" && .event_count == 1 && ${keysAre(unclassifiedKeys)}`), check('dependency warning is a fixed unclassified diagnostic', envelope({ timestamp, level: 'WARN', target: 'hyper::proto', fields: { message: canary, error: canary } }), '.event == "node_warning" && .event_code == "unclassified" && .event_count == 1'), check('dependency error without a message still counts', envelope({ timestamp, level: 'ERROR', target: 'sqlx::pool', fields: { error: canary } }), '.event == "node_error" && .event_code == "unclassified" && .event_count == 1'), check('warning without a target or fields still counts', envelope({ timestamp, level: 'WARN' }), '.event == "node_warning" && .event_code == "unclassified" && .event_count == 1'), @@ -349,6 +392,24 @@ export function requestProfileTests(profile) { no_outputs_from: ['event_route.diagnostic', 'event_route.request', 'event_route.storage_headroom', ...capNames.map(name => `event_route.${name}`)], outputs: [{ extract_from: 'event_route.deletion_ledger', expected_event_count: 1, conditions: [{ type: 'vrl', source: `assert!(.event == "${event}" && .error_kind == "lock_held")\nassert!(${keysAre(ledgerShipped)})\nassert!(${safe})` }] }], })), + // TC-4177: the start line reaches the sink through its own route with every count, and never through the reducer, a cap or the error-event route. + ...LEDGER_START_FILES.map(file => ({ + name: `${profile}: ${LEDGER_START_EVENT} with a ${file} ledger file reaches the sink with its file state and five counts`, + inputs: [{ insert_at: 'logship_gate', type: 'log', log_fields: logFields(envelope(ledgerStart({ ledger_file: file }))) }], + no_outputs_from: ['event_route.diagnostic', 'event_route.request', 'event_route.deletion_ledger', 'event_route.storage_headroom', 'event_route.delegation_mode_boot_reindex', ...capNames.map(name => `event_route.${name}`)], + outputs: [{ extract_from: 'event_route.deletion_ledger_start', expected_event_count: 1, conditions: [{ type: 'vrl', source: `assert!(.event == "${LEDGER_START_EVENT}" && .level == "info" && .svc == "api" && .ledger_file == "${file}" && ${Object.entries(ledgerStartCounts).map(([key, value]) => `.${key} == ${value}`).join(' && ')} && .newest_deleted_at == "${ledgerStartNewest}" && ${keysAre(ledgerStartShipped)})\nassert!(${safe})` }] }], + })), + { + name: `${profile}: ${LEDGER_START_EVENT} failure variant reaches the sink with only its error_kind`, + inputs: [{ insert_at: 'logship_gate', type: 'log', log_fields: logFields(envelope(ledgerStartFailed({ error_kind: 'malformed' }))) }], + no_outputs_from: ['event_route.diagnostic', 'event_route.request', 'event_route.deletion_ledger', ...capNames.map(name => `event_route.${name}`)], + outputs: [{ extract_from: 'event_route.deletion_ledger_start', expected_event_count: 1, conditions: [{ type: 'vrl', source: `assert!(.event == "${LEDGER_START_EVENT}" && .error_kind == "malformed" && .level == "info")\nassert!(${keysAre(ledgerStartFailedShipped)})\nassert!(${safe})` }] }], + }, + { + name: `${profile}: ${LEDGER_START_EVENT} with a free-text file state never reaches the sink route`, + inputs: [{ insert_at: 'logship_gate', type: 'log', log_fields: logFields(envelope(ledgerStart({ ledger_file: canary }))) }], + no_outputs_from: ['event_route.deletion_ledger_start', 'event_route.deletion_ledger', 'event_route.diagnostic', 'event_route.request'], + }, { name: `${profile}: a ledger event with an unlisted error_kind is only a count, never an individual event`, inputs: [{ insert_at: 'logship_gate', type: 'log', log_fields: logFields(envelope(ledgerError('deletion_ledger_unrepaired', { error_kind: 'xyz' }))) }], diff --git a/log-shipper/diagnostics.json b/log-shipper/diagnostics.json index 45718f77..224ec2e2 100644 --- a/log-shipper/diagnostics.json +++ b/log-shipper/diagnostics.json @@ -95,6 +95,7 @@ "Failed to promote database to file": "database_promote_failed", "Not enough free disk to promote a database; keeping it in memory": "database_promote_no_disk", "failed to copy view during table copy": "duckdb_view_copy_failed", + "Database cache cleanup failed": "duckdb_cache_cleanup_failed", "sql ddl allowed without schema ability (ddl_requires_schema = log)": "sql_ddl_without_schema", "Local SQL commit failed": "sql_commit_failed", "Dead SQL actor detected, respawning": "sql_actor_respawned", diff --git a/log-shipper/fields.json b/log-shipper/fields.json index 13ca2a28..11fc8e08 100644 --- a/log-shipper/fields.json +++ b/log-shipper/fields.json @@ -85,7 +85,8 @@ "deletion_ledger_open_failed", "deletion_ledger_replay_failed", "deletion_ledger_unrepaired", - "delegation_mode_boot_reindex" + "delegation_mode_boot_reindex", + "deletion_ledger_start" ], "fields": { "svc": { "type": "enum", "values": ["api", "ingress", "logship"] }, @@ -99,7 +100,7 @@ "query_time_ms": { "type": "number", "min": 0, "max": 86400000 }, "query_count": { "type": "integer", "min": 0, "max": 9007199254740991 }, "error_code": { "type": "enum", "values": ["db_error", "db_timeout", "db_busy", "req_timeout", "read_audit", "storage_io", "caveat_db", "read_tx_error", "key_ledger", "lifecycle", "registry_down", "cutover_fence", "kv_candidate", "engine_error", "encryption", "size_limit", "disk_headroom", "internal"] }, - "event_code": { "type": "enum", "values": ["invocation_replay_insert_failed", "invocation_replay_cleanup_failed", "dstack_get_info_failed", "share_local_tee_identity", "retention_hook_delivery_prune_failed", "retention_dead_letter_prune_failed", "retention_signed_ticket_prune_failed", "quota_invalid_body", "quota_fallback", "tunnel_state_load_failed", "tunnel_address_invalid", "link_state_load_failed", "link_bind_invalid", "link_address_invalid", "link_bind_failed", "link_bind_state_write_failed", "link_tls_config_failed", "link_listener_error", "link_listener_state_write_failed", "link_auto_renew_config_failed", "link_auto_renew_failed", "link_cert_reload_failed", "link_cert_state_missing", "link_listener_cert_reload_failed", "link_disable_failed", "link_connection_error", "link_listener_accept_failed", "webhook_delivery_failed", "webhook_dispatcher_failed", "share_authorization_failed", "share_native_authorization_denied", "share_native_kv_put_failed", "share_v2_readiness_failed", "share_invitation_key_missing", "share_invitation_key_mismatch", "share_policy_denied", "attestation_quote_failed", "hook_events_read_failed", "hook_rows_load_failed", "missing_committed_hook_row", "webhook_enqueue_failed", "tunnel_connection_prepare_failed", "tunnel_idle_timeout", "tunnel_read_failed", "tunnel_malformed_frame", "tunnel_relay_error", "tunnel_write_failed", "tunnel_state_record_failed", "tunnel_state_clear_failed", "tunnel_auth_rejected", "network_did_resolution_enabled", "unclassified", "sql_busy_lock_wait", "sql_busy_hydration", "sql_busy_artifact_transfer", "request_timeout", "deadline_overrun", "sql_hydration_timeout", "read_audit_busy", "read_audit_batch_slow", "read_audit_batch_failed", "read_audit_drain_stalled", "current_kv_c_index_missing", "current_kv_c_index_invalid", "current_kv_c_index_wrong_shape", "db_operation_retried", "db_operation_retry_skipped_slow", "db_failure_5xx", "errors_dropped", "http_5xx", "chain_guard_slow_wait", "db_pool_closed_in_transaction", "sql_database_too_large_to_load", "sql_checkpoint_save_backoff", "kv_head_size_probe_failed", "invoke_rate_limited", "account_limited", "node_top_talkers", "kv_write_value_index_missing", "kv_write_value_index_invalid", "kv_write_value_index_wrong_shape", "sql_checkpoint_too_large", "sql_checkpoint_shrank", "sql_artifact_storage_unavailable", "sql_artifact_changed_during_read", "artifact_part_hash_mismatch", "artifact_part_collection_deferred", "artifact_header_invalid", "artifact_lineage_missing", "artifact_lineage_missing_discarded", "database_open_failed", "database_promote_failed", "database_promote_no_disk", "duckdb_view_copy_failed", "sql_ddl_without_schema", "sql_commit_failed", "sql_actor_respawned", "sql_actor_dead_on_export", "shadow_upload_blocked", "shadow_manifest_read_failed", "shadow_lag_scan_failed", "shadow_drained_behind_pg", "db_connection_lost", "db_retries_suppressed", "db_operation_retry_suppressed", "db_operation_retry_no_deadline", "db_operation_retry_budget_spent", "read_audit_batch_timeout", "kv_blob_refund_failed", "kv_blob_delete_skipped_referenced", "kv_orphan_collection_failed", "delegate_epoch_path_failed", "epoch_insert_failed", "epoch_head_backfill_failed", "invocation_space_missing", "deletion_ledger_lock_wait", "deletion_ledger_replayed", "deletion_ledger_commit_unwritten", "deletion_ledger_commit_unknown", "deletion_ledger_settle_unwritten", "network_create_ceremony_mark_failed", "share_scope_validation_failed", "delivery_authorization_refused", "delivery_rate_limited", "hook_subscriptions_deactivated", "webhook_egress_refresh_failed", "webhook_egress_lookup_failed", "webhook_mark_lease_lost", "webhook_lease_release_failed", "webhook_send_lease_lost", "renewal_scheduler_tick_failed", "renewals_paused", "renewals_resumed", "links_read_clock_skew", "space_purge_reconcile_failed", "space_purge_sweep_failed", "space_purge_phase_failed", "space_purge_release_failed", "space_purge_claim_failed", "owner_erasure_pass_failed", "storage_invalid_space_dirs", "removed_setting_ignored", "admin_stats_over_bound", "admin_stats_query_failed", "attestation_quote_unavailable", "dstack_guest_agent_error", "tunnel_upstream_client_failed", "node_identity_created", "did_resolution_refused", "renewal_scheduler_lease_failed", "session_retire_failed", "delegation_mode_boot_backfill_failed", "delegation_mode_boot_reindex_decrypt_failed", "rocket_deprecated_log_config", "rocket_launched", "delegation_mode_boot_reindex_complete", "delegation_mode_boot_reindex_incomplete", "delegation_mode_boot_reindex_lock_timeout"] }, + "event_code": { "type": "enum", "values": ["invocation_replay_insert_failed", "invocation_replay_cleanup_failed", "dstack_get_info_failed", "share_local_tee_identity", "retention_hook_delivery_prune_failed", "retention_dead_letter_prune_failed", "retention_signed_ticket_prune_failed", "quota_invalid_body", "quota_fallback", "tunnel_state_load_failed", "tunnel_address_invalid", "link_state_load_failed", "link_bind_invalid", "link_address_invalid", "link_bind_failed", "link_bind_state_write_failed", "link_tls_config_failed", "link_listener_error", "link_listener_state_write_failed", "link_auto_renew_config_failed", "link_auto_renew_failed", "link_cert_reload_failed", "link_cert_state_missing", "link_listener_cert_reload_failed", "link_disable_failed", "link_connection_error", "link_listener_accept_failed", "webhook_delivery_failed", "webhook_dispatcher_failed", "share_authorization_failed", "share_native_authorization_denied", "share_native_kv_put_failed", "share_v2_readiness_failed", "share_invitation_key_missing", "share_invitation_key_mismatch", "share_policy_denied", "attestation_quote_failed", "hook_events_read_failed", "hook_rows_load_failed", "missing_committed_hook_row", "webhook_enqueue_failed", "tunnel_connection_prepare_failed", "tunnel_idle_timeout", "tunnel_read_failed", "tunnel_malformed_frame", "tunnel_relay_error", "tunnel_write_failed", "tunnel_state_record_failed", "tunnel_state_clear_failed", "tunnel_auth_rejected", "network_did_resolution_enabled", "unclassified", "sql_busy_lock_wait", "sql_busy_hydration", "sql_busy_artifact_transfer", "request_timeout", "deadline_overrun", "sql_hydration_timeout", "read_audit_busy", "read_audit_batch_slow", "read_audit_batch_failed", "read_audit_drain_stalled", "current_kv_c_index_missing", "current_kv_c_index_invalid", "current_kv_c_index_wrong_shape", "db_operation_retried", "db_operation_retry_skipped_slow", "db_failure_5xx", "errors_dropped", "http_5xx", "chain_guard_slow_wait", "db_pool_closed_in_transaction", "sql_database_too_large_to_load", "sql_checkpoint_save_backoff", "kv_head_size_probe_failed", "invoke_rate_limited", "account_limited", "node_top_talkers", "kv_write_value_index_missing", "kv_write_value_index_invalid", "kv_write_value_index_wrong_shape", "sql_checkpoint_too_large", "sql_checkpoint_shrank", "sql_artifact_storage_unavailable", "sql_artifact_changed_during_read", "artifact_part_hash_mismatch", "artifact_part_collection_deferred", "artifact_header_invalid", "artifact_lineage_missing", "artifact_lineage_missing_discarded", "database_open_failed", "database_promote_failed", "database_promote_no_disk", "duckdb_view_copy_failed", "sql_ddl_without_schema", "sql_commit_failed", "sql_actor_respawned", "sql_actor_dead_on_export", "shadow_upload_blocked", "shadow_manifest_read_failed", "shadow_lag_scan_failed", "shadow_drained_behind_pg", "db_connection_lost", "db_retries_suppressed", "db_operation_retry_suppressed", "db_operation_retry_no_deadline", "db_operation_retry_budget_spent", "read_audit_batch_timeout", "kv_blob_refund_failed", "kv_blob_delete_skipped_referenced", "kv_orphan_collection_failed", "delegate_epoch_path_failed", "epoch_insert_failed", "epoch_head_backfill_failed", "invocation_space_missing", "deletion_ledger_lock_wait", "deletion_ledger_replayed", "deletion_ledger_commit_unwritten", "deletion_ledger_commit_unknown", "deletion_ledger_settle_unwritten", "network_create_ceremony_mark_failed", "share_scope_validation_failed", "delivery_authorization_refused", "delivery_rate_limited", "hook_subscriptions_deactivated", "webhook_egress_refresh_failed", "webhook_egress_lookup_failed", "webhook_mark_lease_lost", "webhook_lease_release_failed", "webhook_send_lease_lost", "renewal_scheduler_tick_failed", "renewals_paused", "renewals_resumed", "links_read_clock_skew", "space_purge_reconcile_failed", "space_purge_sweep_failed", "space_purge_phase_failed", "space_purge_release_failed", "space_purge_claim_failed", "owner_erasure_pass_failed", "storage_invalid_space_dirs", "removed_setting_ignored", "admin_stats_over_bound", "admin_stats_query_failed", "attestation_quote_unavailable", "dstack_guest_agent_error", "tunnel_upstream_client_failed", "node_identity_created", "did_resolution_refused", "renewal_scheduler_lease_failed", "session_retire_failed", "delegation_mode_boot_backfill_failed", "delegation_mode_boot_reindex_decrypt_failed", "rocket_deprecated_log_config", "rocket_launched", "delegation_mode_boot_reindex_complete", "delegation_mode_boot_reindex_incomplete", "delegation_mode_boot_reindex_lock_timeout", "duckdb_cache_cleanup_failed"] }, "event_count": { "type": "integer", "min": 1, "max": 9007199254740991 }, "reason": { "type": "enum", "values": ["malformed_envelope", "unexpected_label", "unlabelled", "non_json", "oversized", "partial", "invalid_fields", "unknown_target", "filtered_level"] }, "count": { "type": "integer", "min": 1, "max": 9007199254740991 }, @@ -117,6 +118,13 @@ "marked_invalid": { "type": "integer", "min": 0, "max": 9007199254740991 }, "skipped_locked_pages": { "type": "integer", "min": 0, "max": 9007199254740991 }, "skipped_decrypt_failed": { "type": "integer", "min": 0, "max": 9007199254740991 }, + "ledger_file": { "type": "enum", "values": ["missing", "empty", "present"] }, + "bytes": { "type": "integer", "min": 0, "max": 9007199254740991 }, + "operations": { "type": "integer", "min": 0, "max": 9007199254740991 }, + "key_entries": { "type": "integer", "min": 0, "max": 9007199254740991 }, + "committed": { "type": "integer", "min": 0, "max": 9007199254740991 }, + "aborted": { "type": "integer", "min": 0, "max": 9007199254740991 }, + "newest_deleted_at": { "type": "string", "regex": "^(none|\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?([Zz]|[+-]\\d{2}:\\d{2}))$", "max_len": 40 }, "failure_kind": { "type": "enum", "values": ["pool_timeout", "pool_closed", "io", "statement_timeout", "serialization", "connection_lost", "artifact_changed", "lock_wait", "hydration", "artifact_transfer", "request_timeout", "read_audit_busy", "other"] }, "write_may_have_applied": { "type": "boolean" }, "classified": { "type": "boolean" }, @@ -227,7 +235,39 @@ "route_template": { "type": "enum", "values": ["/api/agent/chat", "/api/agent/session", "/api/attestation/self", "/api/auth/nonce", "/api/auth/verify", "/api/billing/checkout", "/api/billing/config", "/api/billing/portal", "/api/billing/rates", "/api/billing/status", "/api/billing/webhook", "/api/bots/history/grant", "/api/bots/history/notice", "/api/bots/history/notice/ack", "/api/bots/history/status", "/api/bots/main/messages", "/api/bots/status", "/api/chat", "/api/chat/model-selection", "/api/chat/models", "/api/connectors/credentials/:source", "/api/connectors/credentials/:source/oauth/callback", "/api/connectors/credentials/:source/oauth/start", "/api/connectors/google/autojoin/begin", "/api/connectors/google/autojoin/disable", "/api/connectors/google/autojoin/disconnect", "/api/connectors/google/autojoin/enable", "/api/connectors/google/autojoin/exchange", "/api/connectors/google/autojoin/status", "/api/connectors/google/oauth/callback", "/api/connectors/google/oauth/desktop/start", "/api/connectors/google/oauth/exchange", "/api/connectors/google/oauth/refresh", "/api/connectors/google/oauth/revoke", "/api/connectors/google/oauth/start", "/api/connectors/meetings", "/api/connectors/meetings/:source/:sourceId", "/api/connectors/meetings/:source/:sourceId/reconciled", "/api/connectors/webhooks/:source/:token", "/api/connectors/webhooks/ack", "/api/connectors/webhooks/config", "/api/connectors/webhooks/drain", "/api/connectors/webhooks/pending", "/api/connectors/webhooks/purged", "/api/delegations", "/api/delegations/status", "/api/exo/v1/grant", "/api/exo/v1/requests", "/api/internal/assemblyai-status", "/api/internal/credential-row-count", "/api/manifest", "/api/nras-proxy", "/api/nras-proxy/jwks", "/api/openapi.json", "/api/ops/content-continuity", "/api/phala-verify", "/api/server-info", "/api/signature/:id", "/api/transcriber/assemblyai/capabilities", "/api/transcriber/assemblyai/hosted/admin/reconcile", "/api/transcriber/assemblyai/hosted/jobs/:source_id", "/api/transcriber/assemblyai/hosted/transcripts", "/api/transcriber/assemblyai/hosted/transcripts/:handle", "/api/transcriber/assemblyai/hosted/transcripts/:handle/sentences", "/api/transcriber/assemblyai/hosted/uploads", "/api/transcriber/assemblyai/hosted/uploads/:upload_id", "/api/transcriber/assemblyai/hosted/uploads/:upload_id/parts/:index", "/api/transcriber/assemblyai/transcripts/:id", "/api/transcriber/meetings", "/api/transcriber/meetings/:id", "/api/transcriber/meetings/:id/stop", "/api/transcriber/meetings/:id/transcript", "/api/transcriber/private-cloud/capabilities", "/api/transcriber/private-cloud/transcriptions", "/api/transcriber/private-cloud/transcriptions/:id", "/api/transcriber/private-cloud/transcriptions/:id/cancel", "/api/transcriber/private-cloud/transcriptions/:id/result", "/api/transcriber/webhooks/ptx", "/health", "unmatched"] } } }, - "tinycloud-mcp": { "events": [], "fields": {} }, + "tinycloud-mcp": { + "events": [ + "mcp_listening", + "mcp_tool_call", + "mcp_connect_rejected", + "mcp_approval_dropped", + "mcp_approval_renewal_deferred", + "mcp_approval_collection_failed", + "mcp_approval_ack_failed", + "mcp_approval_result_rejected", + "mcp_node_host_migrated", + "mcp_request_failed", + "mcp_introspection_refused", + "mcp_startup_failed", + "mcp_logship_heartbeat", + "mcp_logship_event_total", + "mcp_logship_dropped_total" + ], + "fields": { + "svc": { "type": "enum", "values": ["mcp"] }, + "tool": { "type": "enum", "values": ["tinycloud_status", "tinycloud_auth_status", "tinycloud_auth_capabilities", "tinycloud_auth_request", "tinycloud_auth_read_scope", "tinycloud_auth_import", "tinycloud_account_spaces_list", "tinycloud_account_applications_list", "tinycloud_kv_list", "tinycloud_kv_get", "tinycloud_read", "tinycloud_kv_head", "tinycloud_kv_put", "tinycloud_kv_delete", "tinycloud_knowledge_list", "tinycloud_knowledge_read", "tinycloud_sql_schema_inspect", "tinycloud_sql_query", "tinycloud_sql_execute", "tinycloud_secrets_get", "tinycloud_secrets_status", "tinycloud_apps_context", "tinycloud_apps_read", "tinycloud_apps_write", "tinycloud_apps_query", "tinycloud_connect", "other"] }, + "code": { "type": "enum", "values": ["INPUT_INVALID", "OPERATION_NOT_FOUND", "OPERATION_VERSION_UNSUPPORTED", "PROFILE_NOT_FOUND", "PROFILE_POSTURE_NOT_ALLOWED", "PROFILE_OWNER_OPT_IN_REQUIRED", "PROFILE_MIGRATION_REQUIRED", "AUTH_REQUIRED", "PERMISSION_DENIED", "SESSION_NOT_FOUND", "PERMISSION_HINT_INVALID", "DELEGATION_ARTIFACT_INVALID", "DELEGATION_EXPIRED", "DELEGATION_AUDIENCE_MISMATCH", "DELEGATION_HOST_MISMATCH", "DELEGATION_REJECTED", "ENCRYPTION_NETWORK_UNRESOLVED", "NODE_UNREACHABLE", "NODE_NOT_RESPONDING", "DECRYPTION_DEPENDENCY_UNAVAILABLE", "NODE_IDENTITY_MISMATCH", "PARTIAL_NODE_WRITE", "RESOURCE_NOT_ROUTED", "REGISTRY_UNAVAILABLE", "NODE_NOT_FOUND", "NODE_REGISTRY_ENTRY_EXISTS", "NODE_ERROR", "STORAGE_QUOTA_EXCEEDED", "KV_NOT_FOUND", "KV_PRECONDITION_FAILED", "KV_CONFLICT", "KV_RESPONSE_TOO_LARGE", "SQL_QUERY_INVALID", "SQL_EXECUTION_FAILED", "SQL_RESULT_LIMIT_EXCEEDED", "SQL_VALUE_UNSAFE", "READ_SOURCE_CHANGED", "READ_CONTEXT_MISMATCH", "SECRET_READ_FAILED", "SECRET_DECRYPT_FAILED", "SECRET_LEGACY_ENVELOPE", "OUTPUT_INVALID", "INTERNAL_ERROR", "ok", "unavailable", "authority_required", "setup_required", "COPY_PARTIAL", "PARTIAL", "REQUEST_EXPIRED", "RESULT_EXPIRED", "ACKNOWLEDGED", "NOT_FOUND", "ACK_CONFLICT", "REQUEST_BINDING", "UNAVAILABLE", "NETWORK", "RESULT_INVALID", "STATE_MISSING", "STATE_INVALID", "STATE_EXPIRED", "STATE_NOT_PENDING", "TENANT_MISSING", "UNKNOWN", "NODE_UNAVAILABLE", "APPROVAL_OWNER_MISMATCH", "RENEWAL_LEASE_MISMATCH", "RENEWAL_GRANT_ENDS_TOO_SOON", "RENEWAL_RENEWER_CHANGED", "RENEWAL_LEASE_ORIGINAL_EXPIRED", "CALLBACK_INCOMPLETE", "SESSION_RESTORE_FAILED", "SESSION_MISMATCH", "RESULT_OWNER_MISMATCH", "APPROVAL_PREDATES_REQUEST", "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED", "AUTH_EXPIRED", "other"] }, + "duration_ms": { "type": "integer", "min": 0, "max": 86400000 }, + "replayed_grants": { "type": "integer", "min": 0, "max": 100000 }, + "reason": { "type": "enum", "values": ["state_missing", "state_invalid", "state_expired", "state_not_pending", "tenant_missing", "openkey_unavailable", "unknown", "openkey_origin_changed", "host_mismatch", "expired", "cid_mismatch", "authority_invalid", "proof_missing", "proof_invalid", "owner_mismatch", "audience_mismatch", "resources_mismatch", "unsupported", "activation_rejected", "activation_unavailable", "activation_unauthenticated", "malformed_envelope", "unexpected_label", "partial", "oversized", "unclassified", "other"] }, + "stage": { "type": "enum", "values": ["restore_approval", "siwe_runtime_delegation", "auth_import", "activation", "renewal", "collect", "owner", "unknown", "other"] }, + "detail": { "type": "enum", "values": ["state_missing", "state_invalid", "state_expired", "state_not_pending", "tenant_missing", "none", "other"] }, + "from_host": { "type": "enum", "values": ["node", "tee_node", "other"] }, + "to_host": { "type": "enum", "values": ["node", "tee_node", "other"] }, + "event_name": { "type": "enum", "values": ["mcp_listening", "mcp_tool_call", "mcp_connect_rejected", "mcp_approval_dropped", "mcp_approval_renewal_deferred", "mcp_approval_collection_failed", "mcp_approval_ack_failed", "mcp_approval_result_rejected", "mcp_node_host_migrated", "mcp_request_failed", "mcp_introspection_refused", "mcp_startup_failed"] }, + "count": { "type": "integer", "min": 0, "max": 1000000000 } + } + }, "ptx-dev": { "events": [], "fields": {} }, "openkey-api": { "events": [], "fields": {} } } diff --git a/log-shipper/ledger-start.test.mjs b/log-shipper/ledger-start.test.mjs new file mode 100644 index 00000000..9563fe85 --- /dev/null +++ b/log-shipper/ledger-start.test.mjs @@ -0,0 +1,46 @@ +// TC-4177: the deletion ledger start event ships its counts only if the canonical schema carries every field the +// shipper emits (the reducer-free route keeps fields, the schema is what the readers validate them against). +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFile } from 'node:fs/promises'; +import { LEDGER_START_EVENT, LEDGER_START_FILES, LEDGER_START_COUNTERS, LEDGER_ERROR_KINDS } from './ledger.mjs'; +import { buildConfig } from '../scripts/tc959-logship.mjs'; + +const nodeSchema = JSON.parse(await readFile(new URL('./fields.json', import.meta.url), 'utf8')).services['tinycloud-node']; +const source = path => readFile(new URL(`../${path}`, import.meta.url), 'utf8'); + +test('the canonical schema declares the start event with every field it ships', () => { + assert.ok(nodeSchema.events.includes(LEDGER_START_EVENT)); + assert.deepEqual(nodeSchema.fields.ledger_file, { type: 'enum', values: [...LEDGER_START_FILES] }); + for (const counter of LEDGER_START_COUNTERS) { + assert.deepEqual(nodeSchema.fields[counter], { type: 'integer', min: 0, max: Number.MAX_SAFE_INTEGER }, counter); + } + const newest = nodeSchema.fields.newest_deleted_at; + assert.equal(newest.type, 'string'); + assert.match('none', new RegExp(newest.regex)); + assert.match('2026-11-23T08:15:30.123456789Z', new RegExp(newest.regex)); + assert.doesNotMatch('2026-11-23T08:15:30Z extra', new RegExp(newest.regex)); + assert.deepEqual(nodeSchema.fields.error_kind.values, [...LEDGER_ERROR_KINDS]); +}); + +test('the start event has its own sink route, and the reducer and caps never see it', () => { + const { sinks, transforms } = buildConfig(); + assert.ok(sinks.betterstack.inputs.includes('event_route.deletion_ledger_start')); + assert.equal(transforms.event_route.route.deletion_ledger_start, `.event == "${LEDGER_START_EVENT}"`); + const nodes = { ...transforms, ...sinks }; + assert.deepEqual(Object.keys(nodes).filter(id => nodes[id].inputs?.includes('event_route.deletion_ledger_start')), ['betterstack']); + assert.ok(transforms.request_profile.condition.includes(`"${LEDGER_START_EVENT}"`)); +}); + +test('the gate lets an info line through on target tinycloud only when it names the start event', () => { + const gate = buildConfig().transforms.logship_gate.source; + assert.match(gate, /target == "tinycloud" && gate_event == "deletion_ledger_start"/); +}); + +test('the DuckDB cache cleanup warning is a warn! carrying its event and a mapped message (TC-4190)', async () => { + const database = await source('tinycloud-core/src/duckdb/database.rs'); + assert.match(database, /tracing::warn!\(\s*event = "duckdb_cache_cleanup_failed",\s*"Database cache cleanup failed"\s*\);/); + const diagnostics = JSON.parse(await source('log-shipper/diagnostics.json')); + assert.equal(diagnostics.exact['Database cache cleanup failed'], 'duckdb_cache_cleanup_failed'); + assert.ok(nodeSchema.fields.event_code.values.includes('duckdb_cache_cleanup_failed')); +}); diff --git a/log-shipper/ledger.mjs b/log-shipper/ledger.mjs index 02c49850..0de01ec2 100644 --- a/log-shipper/ledger.mjs +++ b/log-shipper/ledger.mjs @@ -11,3 +11,15 @@ export const LEDGER_TARGETS = Object.freeze({ deletion_ledger_unrepaired: 'tinycloud_core::encryption_network::deletion_ledger', }); export const LEDGER_ERROR_KINDS = Object.freeze(['io', 'path', 'encode', 'moved', 'lock_held', 'malformed', 'refused', 'db']); +/** + * TC-4177: the one line the node logs per start, after the ledger replay (`log_deletion_ledger_start`, + * tinycloud-node-server/src/lib.rs, target `tinycloud`, info). It ships as an individual event carrying only the file + * state, five bounded counts and the newest `deletedAt` (or `none`); the failure variant carries only `error_kind`. + * `ledger_file` is exactly `LedgerFileState::as_str()`. The event fires once per process: no cap or reducer. + */ +export const LEDGER_START_EVENT = 'deletion_ledger_start'; +export const LEDGER_START_TARGET = 'tinycloud'; +export const LEDGER_START_MESSAGE = 'deletion ledger at start'; +export const LEDGER_START_FAILED_MESSAGE = 'deletion ledger counts unavailable at start'; +export const LEDGER_START_FILES = Object.freeze(['missing', 'empty', 'present']); +export const LEDGER_START_COUNTERS = Object.freeze(['bytes', 'operations', 'key_entries', 'committed', 'aborted']); diff --git a/log-shipper/sanitize.vrl b/log-shipper/sanitize.vrl index 0ad005f7..ff0d62c1 100644 --- a/log-shipper/sanitize.vrl +++ b/log-shipper/sanitize.vrl @@ -76,6 +76,35 @@ if label == "tinycloud-node" { } } } + # TC-4177: the deletion ledger's one line per start (target `tinycloud`, info) ships as an individual event. Either the + # message plus exactly `event`, `ledger_file` (a declared state), five bounded integer counts and `newest_deleted_at` + # (`none` or an RFC 3339 instant: digits, `T`, `:`, `.`, `Z`, `+`, `-` only), or the failure message plus exactly + # `event` and an `error_kind` from the ledger's fixed kinds. The message is never copied. Anything else leaves + # ledger_start null and the info line is dropped below. + ledger_start = null + if target == __LEDGER_START_TARGET__ && level == "info" && (string(f.event) ?? "") == __LEDGER_START_EVENT__ { + if msg == __LEDGER_START_MESSAGE__ && length(f) == 9 { + ls_file = string(f.ledger_file) ?? "" + ls_newest = string(f.newest_deleted_at) ?? "" + if includes(__LEDGER_START_FILES__, ls_file) && match(ls_newest, r'^(none|\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(\.\d{1,9})?([Zz]|[+-]\d{2}:\d{2}))$') { + ls_counts = {} + for_each(__LEDGER_START_COUNTERS__) -> |_index, field| { + value = int(get(f, [field]) ?? null) ?? -1 + if value >= 0 && value <= 9007199254740991 { + ls_counts = set!(ls_counts, [field], value) + } + } + if length(ls_counts) == 5 { + ledger_start = merge(ls_counts, {"event": __LEDGER_START_EVENT__, "svc": "api", "level": "info", "ledger_file": ls_file, "newest_deleted_at": ls_newest}) + } + } + } else if msg == __LEDGER_START_FAILED_MESSAGE__ && length(f) == 3 { + ls_kind = string(f.error_kind) ?? "" + if includes(__LEDGER_ERROR_KINDS__, ls_kind) { + ledger_start = {"event": __LEDGER_START_EVENT__, "svc": "api", "level": "info", "error_kind": ls_kind} + } + } + } # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one @@ -146,6 +175,8 @@ if label == "tinycloud-node" { out = headroom } else if is_object(backfill) { out = backfill + } else if is_object(ledger_start) { + out = ledger_start } else if is_object(ledger) { out = ledger } else { diff --git a/scripts/ci/fixtures/tc959-n0-compose.yaml b/scripts/ci/fixtures/tc959-n0-compose.yaml index 6f08ac71..5b9440c9 100644 --- a/scripts/ci/fixtures/tc959-n0-compose.yaml +++ b/scripts/ci/fixtures/tc959-n0-compose.yaml @@ -209,7 +209,7 @@ services: environment: TINYCLOUD_LOGSHIP_PROFILE: ${TINYCLOUD_LOGSHIP_PROFILE:-errors_slow} BETTERSTACK_SOURCE_TOKEN: ${BETTERSTACK_SOURCE_TOKEN:?seal the node source token before enabling log shipping} - VECTOR_CONFIG_JSON: "{\"data_dir\":\"/var/lib/vector\",\"sources\":{\"gelf_in\":{\"type\":\"socket\",\"mode\":\"udp\",\"address\":\"0.0.0.0:12201\",\"max_length\":262144,\"receive_buffer_bytes\":8388608,\"framing\":{\"method\":\"chunked_gelf\",\"chunked_gelf\":{\"decompression\":\"Auto\"}},\"decoding\":{\"codec\":\"bytes\"}}},\"transforms\":{\"gelf_envelope\":{\"type\":\"remap\",\"inputs\":[\"gelf_in\"],\"source\":\"packet = string(.message) ?? \\\"\\\"\\nif length(packet) > 262144 {\\n . = {\\\"reason\\\": \\\"oversized\\\"}\\n} else {\\n outer, err = parse_json(packet)\\n if err != null || !is_object(outer) || (outer.version != \\\"1.1\\\" && outer.version != \\\"1.0\\\") {\\n . = {\\\"reason\\\": \\\"malformed_envelope\\\"}\\n } else if exists(outer.partial_message) || exists(outer._partial_message) {\\n . = {\\\"reason\\\": \\\"partial\\\"}\\n } else {\\n label = get(outer, [\\\"_tc.logship\\\"]) ?? null\\n . = {\\\"_tc.logship\\\": label, \\\"message\\\": outer.short_message}\\n }\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"logship_gate\":{\"type\":\"remap\",\"inputs\":[\"gelf_envelope\"],\"source\":\"if exists(.reason) {\\n . = {\\\"reason\\\": .reason}\\n} else {\\nlabel = string(get(., [\\\"_tc.logship\\\"]) ?? null) ?? \\\"\\\"\\nraw = .message\\nreason = \\\"\\\"\\nif label == \\\"\\\" { reason = \\\"unlabelled\\\" }\\nelse if !includes([\\\"tinycloud-node\\\", \\\"tinycloud-ingress\\\"], label) { reason = \\\"unexpected_label\\\" }\\nelse if exists(.partial_message) { reason = \\\"partial\\\" }\\nelse if !is_string(raw) { reason = \\\"malformed_envelope\\\" }\\nelse if length(string!(raw)) > 65536 { reason = \\\"oversized\\\" }\\nif reason != \\\"\\\" {\\n . = {\\\"reason\\\": reason}\\n} else {\\n parsed, err = parse_json(string!(raw))\\n if err != null || !is_object(parsed) { . = {\\\"reason\\\": \\\"non_json\\\"} }\\n else if exists(parsed.partial_message) { . = {\\\"reason\\\": \\\"partial\\\"} }\\n else {\\n target = string(parsed.target) ?? \\\"\\\"\\n level = downcase(string(parsed.level) ?? \\\"\\\")\\n if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && target != \\\"tinycloud\\\" && !starts_with(target, \\\"tinycloud::\\\") && target != \\\"tinycloud_core\\\" && !starts_with(target, \\\"tinycloud_core::\\\") {\\n . = {\\\"reason\\\": \\\"unknown_target\\\"}\\n } else if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && !((target == \\\"tinycloud::request\\\" || target == \\\"tinycloud::disk_headroom\\\" || target == \\\"tinycloud_core::models::delegation_mode\\\") && level == \\\"info\\\") {\\n . = {\\\"reason\\\": \\\"filtered_level\\\"}\\n } else { . = {\\\"label\\\": label, \\\"parsed\\\": parsed} }\\n }\\n}\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_route\":{\"type\":\"route\",\"inputs\":[\"logship_gate\"],\"route\":{\"candidate\":\"exists(.parsed)\",\"rejected\":\"exists(.reason)\"}},\"allowlist\":{\"type\":\"remap\",\"inputs\":[\"gate_route.candidate\"],\"source\":\"# Only this fresh object can leave the process boundary. No envelope, span,\\n# message, error, identity, URI or unknown key is copied into it.\\nj = .parsed\\nlabel = .label\\nout = {}\\nts = \\\"\\\"\\nif label == \\\"tinycloud-node\\\" {\\n target = string(j.target) ?? \\\"\\\"\\n level = downcase(string!(j.level))\\n f = object(j.fields) ?? {}\\n msg = string(f.message) ?? \\\"\\\"\\n ts = string!(j.timestamp)\\n # Literal Rocket template aliases only; never split an arbitrary URI.\\n aliases = {\\\"/attestation?\\\":\\\"/attestation\\\",\\\"/.well-known/encryption/network/?\\\":\\\"/.well-known/encryption/network/\\\",\\\"/hooks/events?\\\":\\\"/hooks/events\\\",\\\"/hooks/webhooks?\\\":\\\"/hooks/webhooks\\\",\\\"/public//kv?\\\":\\\"/public//kv\\\"}\\n # TC-1840: the node's one 5xx diagnostic line per database failure ships as an individual event.\\n # The input must carry exactly the declared keys (the message plus these seven, and db_hash only\\n # when it is a valid pseudonym) with exactly the declared types and enum values. Anything else\\n # leaves db_event null and the line falls back to the unclassified count below; no value of it\\n # is ever copied unless it passed, and the shipped object is built from literals and the\\n # validated values only.\\n db_event = null\\n if target == \\\"tinycloud::request\\\" && level == \\\"warn\\\" && msg == \\\"database failure answered with a 5xx\\\" {\\n db_status = f.status\\n db_elapsed = f.elapsed_ms\\n db_code = string(f.code) ?? \\\"\\\"\\n db_service = string(f.service) ?? \\\"\\\"\\n db_kind = string(f.failure_kind) ?? \\\"\\\"\\n db_route = string(f.route) ?? \\\"\\\"\\n db_canonical_route = get(aliases, [db_route]) ?? null\\n if is_string(db_canonical_route) { db_route = db_canonical_route }\\n db_ok = is_integer(db_status) && is_integer(db_elapsed) && is_boolean(f.write_may_have_applied)\\n if db_ok {\\n db_status = int!(db_status)\\n db_elapsed = int!(db_elapsed)\\n db_ok = db_status >= 500 && db_status <= 599 && db_elapsed >= 0 && db_elapsed <= 9007199254740991 && includes([\\\"unavailable_retryable\\\",\\\"outcome_unknown\\\",\\\"internal\\\",\\\"sql_busy\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\"], db_code) && includes([\\\"sql\\\",\\\"duckdb\\\",\\\"kv\\\",\\\"other\\\"], db_service) && includes([\\\"pool_timeout\\\",\\\"pool_closed\\\",\\\"io\\\",\\\"statement_timeout\\\",\\\"serialization\\\",\\\"connection_lost\\\",\\\"artifact_changed\\\",\\\"lock_wait\\\",\\\"hydration\\\",\\\"artifact_transfer\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\",\\\"other\\\"], db_kind) && includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], db_route)\\n }\\n db_hash = string(f.db_hash) ?? \\\"\\\"\\n has_db_hash = exists(f.db_hash)\\n if db_ok {\\n if has_db_hash { db_ok = match(db_hash, r'^[0-9a-f]{64}$') && length(f) == 9 } else { db_ok = length(f) == 8 }\\n }\\n if db_ok {\\n db_event = {\\\"event\\\": \\\"node_warning\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"warn\\\", \\\"event_code\\\": \\\"db_failure_5xx\\\", \\\"status\\\": db_status, \\\"code\\\": db_code, \\\"service\\\": db_service, \\\"route\\\": db_route, \\\"elapsed_ms\\\": db_elapsed, \\\"failure_kind\\\": db_kind, \\\"write_may_have_applied\\\": bool!(f.write_may_have_applied)}\\n if has_db_hash { db_event.db_hash = db_hash }\\n }\\n }\\n # TC-2917: the node's periodic disk headroom line (one per local store) ships as an individual\\n # info event. Exactly the message plus `store` (a declared store) and `free_bytes` (a bounded\\n # integer in whole 64 MiB steps, as the node rounds it); anything else leaves headroom null, and\\n # the info line is then dropped below.\\n headroom = null\\n if target == \\\"tinycloud::disk_headroom\\\" && level == \\\"info\\\" && msg == \\\"storage headroom\\\" && length(f) == 3 {\\n h_store = string(f.store) ?? \\\"\\\"\\n h_free = f.free_bytes\\n if includes([\\\"sql\\\",\\\"duckdb\\\"], h_store) && is_integer(h_free) {\\n h_free = int!(h_free)\\n if h_free >= 0 && h_free <= 9007199254740991 && mod(h_free, 67108864) == 0 {\\n headroom = {\\\"event\\\": \\\"node_storage_headroom\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"store\\\": h_store, \\\"free_bytes\\\": h_free}\\n }\\n }\\n }\\n # TC-3973: ship the boot summary with exactly the seven bounded counters.\\n backfill = null\\n if target == \\\"tinycloud_core::models::delegation_mode\\\" && level == \\\"info\\\" && length(f) == 8 {\\n backfill_code = get({\\\"delegation mode boot reindex complete\\\":\\\"delegation_mode_boot_reindex_complete\\\",\\\"delegation mode boot reindex incomplete; skipped rows remain unmarked and derive on read\\\":\\\"delegation_mode_boot_reindex_incomplete\\\",\\\"delegation mode boot reindex incomplete (lock timeout); remaining rows derive on read\\\":\\\"delegation_mode_boot_reindex_lock_timeout\\\"}, [msg]) ?? null\\n if is_string(backfill_code) {\\n counters = {}\\n for_each([\\\"scanned\\\", \\\"reindexed_terminal\\\", \\\"marked_attenuable\\\", \\\"marked_invalid\\\", \\\"skipped_locked_pages\\\", \\\"skipped_decrypt_failed\\\", \\\"elapsed_ms\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n counters = set!(counters, [field], value)\\n }\\n }\\n if length(counters) == 7 {\\n backfill = merge(counters, {\\\"event\\\": \\\"delegation_mode_boot_reindex\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"event_code\\\": backfill_code})\\n }\\n }\\n }\\n # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired\\n # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error\\n # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one\\n # of the ledger's fixed kinds. The message is never copied. Anything else leaves ledger null and the line falls back\\n # to the unclassified count below.\\n ledger = null\\n l_event = string(f.event) ?? \\\"\\\"\\n if level == \\\"error\\\" && includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], l_event) && exists(f.message) && length(f) == 3 {\\n l_target = get({\\\"deletion_ledger_open_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_replay_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_unrepaired\\\":\\\"tinycloud_core::encryption_network::deletion_ledger\\\"}, [l_event]) ?? \\\"\\\"\\n l_kind = string(f.error_kind) ?? \\\"\\\"\\n if target == l_target && includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], l_kind) {\\n ledger = {\\\"event\\\": l_event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"error\\\", \\\"error_kind\\\": l_kind}\\n }\\n }\\n if target == \\\"tinycloud::request\\\" && level == \\\"info\\\" && msg == \\\"request\\\" {\\n method = string!(f.method)\\n if includes([\\\"TRACE\\\", \\\"CONNECT\\\"], method) { method = \\\"\\\" }\\n route = string!(f.route)\\n canonical_route = get(aliases, [route]) ?? null\\n if is_string(canonical_route) { route = canonical_route }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = f.status\\n latency = f.latency_us\\n if !is_integer(status) || !is_integer(latency) { abort }\\n status = int!(status)\\n latency = int!(latency)\\n if status < 100 || status > 599 || latency < 0 || latency > 9007199254740991 { abort }\\n out = {\\\"event\\\": \\\"node_request\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"latency_us\\\": latency}\\n # N2 correlation fields: copied only when they have exactly the node's emitted shape; anything else is dropped\\n # (the event still ships). The pseudonyms are keyed HMAC-SHA256 digests, never raw identifiers.\\n rid = string(f.request_id) ?? \\\"\\\"\\n if match(rid, r'^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') { out.request_id = rid }\\n replaced = f.request_id_replaced\\n if is_boolean(replaced) { out.request_id_replaced = replaced }\\n account = string(f.account_hash) ?? \\\"\\\"\\n if match(account, r'^[0-9a-f]{64}$') { out.account_hash = account }\\n space = string(f.space_hash) ?? \\\"\\\"\\n if match(space, r'^[0-9a-f]{64}$') { out.space_hash = space }\\n # TC-3834: the 5xx origin, on status 500 and above only, and only when it is exactly one of the declared codes;\\n # anything else is dropped (the event still ships). A closed vocabulary, never error text.\\n if status >= 500 {\\n error_code = string(f.error_code) ?? \\\"\\\"\\n if includes([\\\"db_error\\\",\\\"db_timeout\\\",\\\"db_busy\\\",\\\"req_timeout\\\",\\\"read_audit\\\",\\\"storage_io\\\",\\\"caveat_db\\\",\\\"read_tx_error\\\",\\\"key_ledger\\\",\\\"lifecycle\\\",\\\"registry_down\\\",\\\"cutover_fence\\\",\\\"kv_candidate\\\",\\\"engine_error\\\",\\\"encryption\\\",\\\"size_limit\\\",\\\"disk_headroom\\\",\\\"internal\\\"], error_code) { out.error_code = error_code }\\n }\\n # TC-3739: per-request DB accounting, on status below 400 only (4xx/5xx are the capped classes; DB-caused 5xx\\n # already carry elapsed_ms on db_failure_5xx). Copied only as plain numbers inside the canonical bounds; anything\\n # else is dropped (the event still ships). They are driver wall times and an attempt count, never identifiers.\\n if status < 400 {\\n pool_wait = f.pool_wait_ms\\n if is_float(pool_wait) || is_integer(pool_wait) {\\n pool_wait = to_float!(pool_wait)\\n if pool_wait >= 0.0 && pool_wait <= 86400000.0 { out.pool_wait_ms = pool_wait }\\n }\\n query_time = f.query_time_ms\\n if is_float(query_time) || is_integer(query_time) {\\n query_time = to_float!(query_time)\\n if query_time >= 0.0 && query_time <= 86400000.0 { out.query_time_ms = query_time }\\n }\\n query_count = f.query_count\\n if is_integer(query_count) {\\n query_count = int!(query_count)\\n if query_count >= 0 && query_count <= 9007199254740991 { out.query_count = query_count }\\n }\\n }\\n } else if is_object(db_event) {\\n out = db_event\\n } else if is_object(headroom) {\\n out = headroom\\n } else if is_object(backfill) {\\n out = backfill\\n } else if is_object(ledger) {\\n out = ledger\\n } else {\\n if !includes([\\\"warn\\\", \\\"error\\\"], level) { abort }\\n code = \\\"unclassified\\\"\\n if target == \\\"tinycloud\\\" || starts_with(target, \\\"tinycloud::\\\") || target == \\\"tinycloud_core\\\" || starts_with(target, \\\"tinycloud_core::\\\") {\\n codes = {\\\"delegation mode boot backfill failed; unmarked rows derive on read\\\":\\\"delegation_mode_boot_backfill_failed\\\",\\\"delegation mode boot reindex skipped rows that failed decryption; leaving unmarked for read-time fail-closed handling\\\":\\\"delegation_mode_boot_reindex_decrypt_failed\\\",\\\"invocation replay insert failed\\\":\\\"invocation_replay_insert_failed\\\",\\\"invocation replay cleanup failed\\\":\\\"invocation_replay_cleanup_failed\\\",\\\"share-v2 local-tee feature active: deriving a deterministic, non-attested TEE identity from node key material\\\":\\\"share_local_tee_identity\\\",\\\"retention: delivered hook delivery prune failed\\\":\\\"retention_hook_delivery_prune_failed\\\",\\\"retention: dead-letter hook delivery prune failed\\\":\\\"retention_dead_letter_prune_failed\\\",\\\"retention: signed KV ticket prune failed\\\":\\\"retention_signed_ticket_prune_failed\\\",\\\"failed to load tunnel state; tunnel not started\\\":\\\"tunnel_state_load_failed\\\",\\\"invalid loopback API address; tunnel not started\\\":\\\"tunnel_address_invalid\\\",\\\"failed to load link state; LAN listener not started\\\":\\\"link_state_load_failed\\\",\\\"invalid link bind address; LAN listener not started\\\":\\\"link_bind_invalid\\\",\\\"invalid loopback API address; LAN listener not started\\\":\\\"link_address_invalid\\\",\\\"failed to bind link LAN listener; LAN listener not started\\\":\\\"link_bind_failed\\\",\\\"failed to build TLS config; LAN listener not started\\\":\\\"link_tls_config_failed\\\",\\\"link LAN listener exited with error\\\":\\\"link_listener_error\\\",\\\"failed to record link listener bind state\\\":\\\"link_listener_state_write_failed\\\",\\\"failed to record link listener bind failure\\\":\\\"link_bind_state_write_failed\\\",\\\"failed to load config for auto-renew\\\":\\\"link_auto_renew_config_failed\\\",\\\"link auto-renew failed\\\":\\\"link_auto_renew_failed\\\",\\\"failed to hot-reload renewed link cert\\\":\\\"link_cert_reload_failed\\\",\\\"link auto-renew succeeded but no state.json found; skipping cert hot-reload\\\":\\\"link_cert_state_missing\\\",\\\"failed to reload TLS material after link auto-renew\\\":\\\"link_listener_cert_reload_failed\\\",\\\"link disable: service delete failed; local state removed anyway\\\":\\\"link_disable_failed\\\",\\\"link connection error\\\":\\\"link_connection_error\\\",\\\"link listener accept error\\\":\\\"link_listener_accept_failed\\\",\\\"webhook delivery attempt failed\\\":\\\"webhook_delivery_failed\\\",\\\"webhook dispatcher loop failed\\\":\\\"webhook_dispatcher_failed\\\",\\\"addressed delegation authorization failed\\\":\\\"share_authorization_failed\\\",\\\"native share authorization denied\\\":\\\"share_native_authorization_denied\\\",\\\"native share KV put failed\\\":\\\"share_native_kv_put_failed\\\",\\\"share v2 readiness probe failed\\\":\\\"share_v2_readiness_failed\\\",\\\"share v2 is enabled but shareEmail.invitationPublicKey is unset\\\":\\\"share_invitation_key_missing\\\",\\\"configured share invitation key does not match the node's derived signing key\\\":\\\"share_invitation_key_mismatch\\\",\\\"share/v2 policy challenge denied\\\":\\\"share_policy_denied\\\",\\\"failed to read committed hook events\\\":\\\"hook_events_read_failed\\\",\\\"failed to load kv write hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"failed to load kv delete hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"missing committed kv hook row for invocation\\\":\\\"missing_committed_hook_row\\\",\\\"database write committed but webhook enqueue failed\\\":\\\"webhook_enqueue_failed\\\",\\\"tunnel: failed to prepare connection attempt\\\":\\\"tunnel_connection_prepare_failed\\\",\\\"tunnel: no frame within idle timeout; treating connection as dead\\\":\\\"tunnel_idle_timeout\\\",\\\"tunnel: read error\\\":\\\"tunnel_read_failed\\\",\\\"tunnel: dropping malformed frame\\\":\\\"tunnel_malformed_frame\\\",\\\"tunnel: relay sent an error frame\\\":\\\"tunnel_relay_error\\\",\\\"tunnel: failed to write frame\\\":\\\"tunnel_write_failed\\\",\\\"tunnel: failed to record runtime state\\\":\\\"tunnel_state_record_failed\\\",\\\"tunnel: failed to clear runtime state after disable\\\":\\\"tunnel_state_clear_failed\\\",\\\"tunnel authentication rejected\\\":\\\"tunnel_auth_rejected\\\",\\\"network DID resolution enabled: did:web/did:tz fetches use the unhardened ssi client (TC-1080)\\\":\\\"network_did_resolution_enabled\\\",\\\"SQL busy: lock wait\\\":\\\"sql_busy_lock_wait\\\",\\\"SQL busy: hydration\\\":\\\"sql_busy_hydration\\\",\\\"SQL busy: artifact transfer\\\":\\\"sql_busy_artifact_transfer\\\",\\\"Request deadline exceeded\\\":\\\"request_timeout\\\",\\\"Request completed after its deadline\\\":\\\"deadline_overrun\\\",\\\"Database hydration gave up loading its artifact\\\":\\\"sql_hydration_timeout\\\",\\\"Read audit wait expired\\\":\\\"read_audit_busy\\\",\\\"Read audit batch slow\\\":\\\"read_audit_batch_slow\\\",\\\"Read audit batch failed\\\":\\\"read_audit_batch_failed\\\",\\\"Read audit drain stalled\\\":\\\"read_audit_drain_stalled\\\",\\\"retrying operation after a lost database connection\\\":\\\"db_operation_retried\\\",\\\"not retrying operation: its first run took longer than the retry window to fail\\\":\\\"db_operation_retry_skipped_slow\\\",\\\"idx_current_kv_space_deleted_key_c is missing; the node keeps serving and KV list requests are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_current_kv_space_deleted_key_c)\\\":\\\"current_kv_c_index_missing\\\",\\\"idx_current_kv_space_deleted_key_c is invalid or still being built; the node keeps serving and KV list requests are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_invalid\\\",\\\"idx_current_kv_space_deleted_key_c exists with the wrong definition and is not used for KV lists; the node keeps serving and KV list requests are slower. Run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_wrong_shape\\\",\\\"idx_kv_write_space_value is missing; the node keeps serving and KV writes that attach a blob are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_kv_write_space_value)\\\":\\\"kv_write_value_index_missing\\\",\\\"idx_kv_write_space_value is invalid or still being built; the node keeps serving and KV writes that attach a blob are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_invalid\\\",\\\"idx_kv_write_space_value exists with the wrong definition and is not used for blob reference checks; the node keeps serving and KV writes that attach a blob are slower. Run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_wrong_shape\\\",\\\"request answered with a 5xx\\\":\\\"http_5xx\\\",\\\"chain guard wait exceeded the slow-wait threshold\\\":\\\"chain_guard_slow_wait\\\",\\\"kv head size probe failed; size omitted\\\":\\\"kv_head_size_probe_failed\\\",\\\"Database checkpoint save failed; refusing its writes until the back-off ends\\\":\\\"sql_checkpoint_save_backoff\\\",\\\"Database exceeds the artifact read limit; not loaded\\\":\\\"sql_database_too_large_to_load\\\",\\\"Database checkpoint exceeds the artifact write limit; not saved\\\":\\\"sql_checkpoint_too_large\\\",\\\"Database checkpoint shrank sharply against the artifact it replaces\\\":\\\"sql_checkpoint_shrank\\\",\\\"Database artifact storage unavailable\\\":\\\"sql_artifact_storage_unavailable\\\",\\\"Database artifact kept changing while it was read\\\":\\\"sql_artifact_changed_during_read\\\",\\\"Artifact part integrity check failed\\\":\\\"artifact_part_hash_mismatch\\\",\\\"Artifact part collection deferred\\\":\\\"artifact_part_collection_deferred\\\",\\\"Durable database artifact does not carry the expected file header; refusing to hydrate\\\":\\\"artifact_header_invalid\\\",\\\"No recorded artifact lineage for a live database; saving without a lineage assertion\\\":\\\"artifact_lineage_missing\\\",\\\"No recorded artifact lineage for a live database; discarding the actor\\\":\\\"artifact_lineage_missing_discarded\\\",\\\"Failed to open database\\\":\\\"database_open_failed\\\",\\\"Failed to promote database to file\\\":\\\"database_promote_failed\\\",\\\"Not enough free disk to promote a database; keeping it in memory\\\":\\\"database_promote_no_disk\\\",\\\"failed to copy view during table copy\\\":\\\"duckdb_view_copy_failed\\\",\\\"sql ddl allowed without schema ability (ddl_requires_schema = log)\\\":\\\"sql_ddl_without_schema\\\",\\\"Local SQL commit failed\\\":\\\"sql_commit_failed\\\",\\\"Dead SQL actor detected, respawning\\\":\\\"sql_actor_respawned\\\",\\\"Dead SQL actor detected during export, removing\\\":\\\"sql_actor_dead_on_export\\\",\\\"sql_store shadow upload blocked for a database\\\":\\\"shadow_upload_blocked\\\",\\\"sql_store shadow could not read a manifest row\\\":\\\"shadow_manifest_read_failed\\\",\\\"sql_store shadow lag scan failed\\\":\\\"shadow_lag_scan_failed\\\",\\\"sql_store shadow drained behind PG\\\":\\\"shadow_drained_behind_pg\\\",\\\"database connection lost\\\":\\\"db_connection_lost\\\",\\\"retries suppressed after a database overload signal\\\":\\\"db_retries_suppressed\\\",\\\"not retrying operation: retries are suppressed after a database overload signal\\\":\\\"db_operation_retry_suppressed\\\",\\\"not retrying operation: the request deadline leaves no room\\\":\\\"db_operation_retry_no_deadline\\\",\\\"retry attempt stopped: the operation budget expired\\\":\\\"db_operation_retry_budget_spent\\\",\\\"Read audit batch timed out\\\":\\\"read_audit_batch_timeout\\\",\\\"failed to refund orphaned KV blob; periodic collector will retry\\\":\\\"kv_blob_refund_failed\\\",\\\"a deleting fence named a blob that a committed write references; it was closed without deleting the blob\\\":\\\"kv_blob_delete_skipped_referenced\\\",\\\"KV orphan collection failed\\\":\\\"kv_orphan_collection_failed\\\",\\\"delegate epoch path failed\\\":\\\"delegate_epoch_path_failed\\\",\\\"epoch insert failed\\\":\\\"epoch_insert_failed\\\",\\\"epoch head backfill stopped at its first error; writes stay correct and repair each space on its next write\\\":\\\"epoch_head_backfill_failed\\\",\\\"invocation referenced a space absent from the database\\\":\\\"invocation_space_missing\\\",\\\"deletion ledger is locked by another process: waiting for it\\\":\\\"deletion_ledger_lock_wait\\\",\\\"deletion ledger replayed at start\\\":\\\"deletion_ledger_replayed\\\",\\\"deletion ledger: committed line was not written\\\":\\\"deletion_ledger_commit_unwritten\\\",\\\"deletion ledger: could not tell whether a delete committed; the operation stays open\\\":\\\"deletion_ledger_commit_unknown\\\",\\\"deletion ledger: the settling line was not written\\\":\\\"deletion_ledger_settle_unwritten\\\",\\\"could not record losing network create ceremony as failed\\\":\\\"network_create_ceremony_mark_failed\\\",\\\"share scope validation failed\\\":\\\"share_scope_validation_failed\\\",\\\"delivery authorization refused\\\":\\\"delivery_authorization_refused\\\",\\\"delivery authorizations refused by the rate limit\\\":\\\"delivery_rate_limited\\\",\\\"deactivated webhook subscriptions; owners must re-register\\\":\\\"hook_subscriptions_deactivated\\\",\\\"webhook egress closed: internal endpoint refresh failed\\\":\\\"webhook_egress_refresh_failed\\\",\\\"webhook egress closed: internal endpoint lookup failed\\\":\\\"webhook_egress_lookup_failed\\\",\\\"webhook delivery mark refused: lease no longer held\\\":\\\"webhook_mark_lease_lost\\\",\\\"webhook delivery lease release failed\\\":\\\"webhook_lease_release_failed\\\",\\\"webhook delivery send skipped: lease no longer held\\\":\\\"webhook_send_lease_lost\\\",\\\"internal renewal scheduler pass failed\\\":\\\"renewal_scheduler_tick_failed\\\",\\\"renewals paused node-wide\\\":\\\"renewals_paused\\\",\\\"renewals resumed node-wide\\\":\\\"renewals_resumed\\\",\\\"the links API clock differs from the node clock\\\":\\\"links_read_clock_skew\\\",\\\"purge ledger reconciliation failed; space traffic stays refused\\\":\\\"space_purge_reconcile_failed\\\",\\\"space purge residue sweep failed\\\":\\\"space_purge_sweep_failed\\\",\\\"space purge phase failed; retrying later\\\":\\\"space_purge_phase_failed\\\",\\\"space purge attempt release failed\\\":\\\"space_purge_release_failed\\\",\\\"space purge claim failed\\\":\\\"space_purge_claim_failed\\\",\\\"owner erasure pass failed; retrying later\\\":\\\"owner_erasure_pass_failed\\\",\\\"skipped invalid space directories while measuring storage\\\":\\\"storage_invalid_space_dirs\\\",\\\"removed setting is set and ignored; delete it from the configuration\\\":\\\"removed_setting_ignored\\\",\\\"admin stats result exceeds its bound\\\":\\\"admin_stats_over_bound\\\",\\\"admin stats query failed\\\":\\\"admin_stats_query_failed\\\",\\\"TDX quote unavailable\\\":\\\"attestation_quote_unavailable\\\",\\\"dstack guest agent returned an error\\\":\\\"dstack_guest_agent_error\\\",\\\"tunnel: failed to build upstream HTTP client\\\":\\\"tunnel_upstream_client_failed\\\"}\\n known = get(codes, [msg]) ?? null\\n if is_string(known) { code = known }\\n if starts_with(msg, \\\"quota service returned \\\") { code = \\\"quota_fallback\\\" }\\nif starts_with(msg, \\\"Failed to get TDX quote: \\\") { code = \\\"attestation_quote_failed\\\" }\\nif starts_with(msg, \\\"created a new node identity at \\\") { code = \\\"node_identity_created\\\" }\\nif starts_with(msg, \\\"quota service returned an invalid body: \\\") { code = \\\"quota_invalid_body\\\" }\\nif starts_with(msg, \\\"dstack socket available but get_info failed: \\\") { code = \\\"dstack_get_info_failed\\\" }\\n # TC-3284: a line with no message is named by its constant `event` field, only when that event is listed.\\n if msg == \\\"\\\" && !exists(f.message) {\\n events = {\\\"did_resolution_refused\\\":\\\"did_resolution_refused\\\",\\\"renewal_scheduler_lease_failed\\\":\\\"renewal_scheduler_lease_failed\\\",\\\"session_retire_failed\\\":\\\"session_retire_failed\\\"}\\n named = get(events, [string(f.event) ?? \\\"\\\"]) ?? null\\n if is_string(named) { code = named }\\n }\\n }\\n if level == \\\"warn\\\" && target == \\\"rocket::config::config\\\" && msg == \\\"found value for deprecated config key `log`\\\" { code = \\\"rocket_deprecated_log_config\\\" }\\nif level == \\\"warn\\\" && target == \\\"rocket::launch\\\" && starts_with(msg, \\\"Rocket has launched from \\\") { code = \\\"rocket_launched\\\" }\\n event = if level == \\\"warn\\\" { \\\"node_warning\\\" } else { \\\"node_error\\\" }\\n out = {\\\"event\\\": event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": level, \\\"event_code\\\": code, \\\"event_count\\\": 1}\\n }\\n} else {\\n ts = string!(j.time)\\n method = string!(j.method)\\n route = string!(j.route)\\n if route == \\\"\\\" { route = \\\"\\\" }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = j.status\\n request_time = j.request_time\\n if !is_integer(status) || !(is_integer(request_time) || is_float(request_time)) { abort }\\n status = int!(status)\\n request_time = to_float!(request_time)\\n if status < 100 || status > 599 || request_time < 0 || request_time > 86400 { abort }\\n out = {\\\"event\\\": \\\"ingress_request\\\", \\\"svc\\\": \\\"ingress\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"request_time_seconds\\\": request_time}\\n}\\nif length(ts) > 64 { abort }\\nparsed_ts = parse_timestamp!(ts, format: \\\"%+\\\")\\nout.ts = format_timestamp!(parsed_ts, format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\")\\n. = out\\n\",\"drop_on_error\":true,\"drop_on_abort\":true,\"reroute_dropped\":true},\"gate_counts\":{\"type\":\"remap\",\"inputs\":[\"gate_route.rejected\",\"gate_route._unmatched\",\"allowlist.dropped\",\"event_route._unmatched\"],\"source\":\"reason = .reason\\nif !includes([\\\"malformed_envelope\\\",\\\"unexpected_label\\\",\\\"unlabelled\\\",\\\"non_json\\\",\\\"oversized\\\",\\\"partial\\\",\\\"invalid_fields\\\",\\\"unknown_target\\\",\\\"filtered_level\\\"], reason) { reason = \\\"invalid_fields\\\" }\\n. = {\\\"reason\\\": reason, \\\"count\\\": 1}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_reduce\":{\"type\":\"reduce\",\"inputs\":[\"gate_counts\"],\"group_by\":[\"reason\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"count\":\"sum\"}},\"gate_output\":{\"type\":\"remap\",\"inputs\":[\"gate_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": \\\"warn\\\", \\\"event\\\": \\\"logship_gate_summary_total\\\", \\\"svc\\\": \\\"logship\\\", \\\"reason\\\": .reason, \\\"count\\\": .count}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"request_profile\":{\"type\":\"filter\",\"inputs\":[\"allowlist\"],\"condition\":\"\\\"$${TINYCLOUD_LOGSHIP_PROFILE}\\\" == \\\"all_requests\\\" || includes([\\\"node_warning\\\",\\\"node_error\\\",\\\"node_storage_headroom\\\",\\\"delegation_mode_boot_reindex\\\",\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event) || (int(.status) ?? 0) >= 400 || (.event == \\\"node_request\\\" && (int(.latency_us) ?? 0) > 1000000) || (.event == \\\"ingress_request\\\" && (to_float(.request_time_seconds) ?? 0.0) > 1.000000)\"},\"event_route\":{\"type\":\"route\",\"inputs\":[\"request_profile\"],\"route\":{\"request\":\"(.event == \\\"node_request\\\" || .event == \\\"ingress_request\\\") && !(((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)) && !((int(.status) ?? 0) >= 500)\",\"node_request_5xx\":\".event == \\\"node_request\\\" && (int(.status) ?? 0) >= 500\",\"ingress_request_5xx\":\".event == \\\"ingress_request\\\" && (int(.status) ?? 0) >= 500\",\"node_request_4xx\":\".event == \\\"node_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"ingress_request_4xx\":\".event == \\\"ingress_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"db_failure_5xx\":\".event == \\\"node_warning\\\" && .event_code == \\\"db_failure_5xx\\\"\",\"storage_headroom\":\".event == \\\"node_storage_headroom\\\"\",\"delegation_mode_boot_reindex\":\".event == \\\"delegation_mode_boot_reindex\\\"\",\"deletion_ledger\":\"includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event)\",\"diagnostic\":\"(.event == \\\"node_warning\\\" && .event_code != \\\"db_failure_5xx\\\") || .event == \\\"node_error\\\"\"}},\"cap_db_failure_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.db_failure_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"db_failure_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"diagnostic_reduce\":{\"type\":\"reduce\",\"inputs\":[\"event_route.diagnostic\"],\"group_by\":[\"event\",\"event_code\",\"level\",\"svc\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"event_count\":\"sum\",\"ts\":\"discard\"}},\"diagnostic_output\":{\"type\":\"remap\",\"inputs\":[\"diagnostic_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": .level, \\\"event\\\": .event, \\\"svc\\\": \\\"api\\\", \\\"event_code\\\": .event_code, \\\"event_count\\\": .event_count}\",\"drop_on_error\":true,\"drop_on_abort\":true}},\"sinks\":{\"betterstack\":{\"type\":\"http\",\"inputs\":[\"event_route.request\",\"event_route.storage_headroom\",\"event_route.delegation_mode_boot_reindex\",\"event_route.deletion_ledger\",\"cap_db_failure_5xx\",\"cap_node_request_5xx\",\"cap_ingress_request_5xx\",\"cap_node_request_4xx\",\"cap_ingress_request_4xx\",\"diagnostic_output\",\"gate_output\"],\"method\":\"post\",\"uri\":\"https://s2795437.us-west-2a.betterstackdata.com/\",\"encoding\":{\"codec\":\"json\"},\"framing\":{\"method\":\"newline_delimited\"},\"compression\":\"gzip\",\"auth\":{\"strategy\":\"bearer\",\"token\":\"SECRET[bs.bs_token]\"},\"batch\":{\"max_bytes\":262144,\"timeout_secs\":1},\"buffer\":{\"type\":\"memory\",\"max_events\":1000,\"when_full\":\"block\"},\"request\":{\"timeout_secs\":10,\"retry_max_duration_secs\":300},\"healthcheck\":{\"enabled\":false}}},\"secret\":{\"bs\":{\"type\":\"directory\",\"path\":\"/var/lib/vector/secrets\",\"remove_trailing_whitespace\":true}}}" + VECTOR_CONFIG_JSON: "{\"data_dir\":\"/var/lib/vector\",\"sources\":{\"gelf_in\":{\"type\":\"socket\",\"mode\":\"udp\",\"address\":\"0.0.0.0:12201\",\"max_length\":262144,\"receive_buffer_bytes\":8388608,\"framing\":{\"method\":\"chunked_gelf\",\"chunked_gelf\":{\"decompression\":\"Auto\"}},\"decoding\":{\"codec\":\"bytes\"}}},\"transforms\":{\"gelf_envelope\":{\"type\":\"remap\",\"inputs\":[\"gelf_in\"],\"source\":\"packet = string(.message) ?? \\\"\\\"\\nif length(packet) > 262144 {\\n . = {\\\"reason\\\": \\\"oversized\\\"}\\n} else {\\n outer, err = parse_json(packet)\\n if err != null || !is_object(outer) || (outer.version != \\\"1.1\\\" && outer.version != \\\"1.0\\\") {\\n . = {\\\"reason\\\": \\\"malformed_envelope\\\"}\\n } else if exists(outer.partial_message) || exists(outer._partial_message) {\\n . = {\\\"reason\\\": \\\"partial\\\"}\\n } else {\\n label = get(outer, [\\\"_tc.logship\\\"]) ?? null\\n . = {\\\"_tc.logship\\\": label, \\\"message\\\": outer.short_message}\\n }\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"logship_gate\":{\"type\":\"remap\",\"inputs\":[\"gelf_envelope\"],\"source\":\"if exists(.reason) {\\n . = {\\\"reason\\\": .reason}\\n} else {\\nlabel = string(get(., [\\\"_tc.logship\\\"]) ?? null) ?? \\\"\\\"\\nraw = .message\\nreason = \\\"\\\"\\nif label == \\\"\\\" { reason = \\\"unlabelled\\\" }\\nelse if !includes([\\\"tinycloud-node\\\", \\\"tinycloud-ingress\\\"], label) { reason = \\\"unexpected_label\\\" }\\nelse if exists(.partial_message) { reason = \\\"partial\\\" }\\nelse if !is_string(raw) { reason = \\\"malformed_envelope\\\" }\\nelse if length(string!(raw)) > 65536 { reason = \\\"oversized\\\" }\\nif reason != \\\"\\\" {\\n . = {\\\"reason\\\": reason}\\n} else {\\n parsed, err = parse_json(string!(raw))\\n if err != null || !is_object(parsed) { . = {\\\"reason\\\": \\\"non_json\\\"} }\\n else if exists(parsed.partial_message) { . = {\\\"reason\\\": \\\"partial\\\"} }\\n else {\\n target = string(parsed.target) ?? \\\"\\\"\\n level = downcase(string(parsed.level) ?? \\\"\\\")\\n gate_fields = object(parsed.fields) ?? {}\\n gate_event = string(gate_fields.event) ?? \\\"\\\"\\n if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && target != \\\"tinycloud\\\" && !starts_with(target, \\\"tinycloud::\\\") && target != \\\"tinycloud_core\\\" && !starts_with(target, \\\"tinycloud_core::\\\") {\\n . = {\\\"reason\\\": \\\"unknown_target\\\"}\\n } else if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && !((target == \\\"tinycloud::request\\\" || target == \\\"tinycloud::disk_headroom\\\" || target == \\\"tinycloud_core::models::delegation_mode\\\" || (target == \\\"tinycloud\\\" && gate_event == \\\"deletion_ledger_start\\\")) && level == \\\"info\\\") {\\n . = {\\\"reason\\\": \\\"filtered_level\\\"}\\n } else { . = {\\\"label\\\": label, \\\"parsed\\\": parsed} }\\n }\\n}\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_route\":{\"type\":\"route\",\"inputs\":[\"logship_gate\"],\"route\":{\"candidate\":\"exists(.parsed)\",\"rejected\":\"exists(.reason)\"}},\"allowlist\":{\"type\":\"remap\",\"inputs\":[\"gate_route.candidate\"],\"source\":\"# Only this fresh object can leave the process boundary. No envelope, span,\\n# message, error, identity, URI or unknown key is copied into it.\\nj = .parsed\\nlabel = .label\\nout = {}\\nts = \\\"\\\"\\nif label == \\\"tinycloud-node\\\" {\\n target = string(j.target) ?? \\\"\\\"\\n level = downcase(string!(j.level))\\n f = object(j.fields) ?? {}\\n msg = string(f.message) ?? \\\"\\\"\\n ts = string!(j.timestamp)\\n # Literal Rocket template aliases only; never split an arbitrary URI.\\n aliases = {\\\"/attestation?\\\":\\\"/attestation\\\",\\\"/.well-known/encryption/network/?\\\":\\\"/.well-known/encryption/network/\\\",\\\"/hooks/events?\\\":\\\"/hooks/events\\\",\\\"/hooks/webhooks?\\\":\\\"/hooks/webhooks\\\",\\\"/public//kv?\\\":\\\"/public//kv\\\"}\\n # TC-1840: the node's one 5xx diagnostic line per database failure ships as an individual event.\\n # The input must carry exactly the declared keys (the message plus these seven, and db_hash only\\n # when it is a valid pseudonym) with exactly the declared types and enum values. Anything else\\n # leaves db_event null and the line falls back to the unclassified count below; no value of it\\n # is ever copied unless it passed, and the shipped object is built from literals and the\\n # validated values only.\\n db_event = null\\n if target == \\\"tinycloud::request\\\" && level == \\\"warn\\\" && msg == \\\"database failure answered with a 5xx\\\" {\\n db_status = f.status\\n db_elapsed = f.elapsed_ms\\n db_code = string(f.code) ?? \\\"\\\"\\n db_service = string(f.service) ?? \\\"\\\"\\n db_kind = string(f.failure_kind) ?? \\\"\\\"\\n db_route = string(f.route) ?? \\\"\\\"\\n db_canonical_route = get(aliases, [db_route]) ?? null\\n if is_string(db_canonical_route) { db_route = db_canonical_route }\\n db_ok = is_integer(db_status) && is_integer(db_elapsed) && is_boolean(f.write_may_have_applied)\\n if db_ok {\\n db_status = int!(db_status)\\n db_elapsed = int!(db_elapsed)\\n db_ok = db_status >= 500 && db_status <= 599 && db_elapsed >= 0 && db_elapsed <= 9007199254740991 && includes([\\\"unavailable_retryable\\\",\\\"outcome_unknown\\\",\\\"internal\\\",\\\"sql_busy\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\"], db_code) && includes([\\\"sql\\\",\\\"duckdb\\\",\\\"kv\\\",\\\"other\\\"], db_service) && includes([\\\"pool_timeout\\\",\\\"pool_closed\\\",\\\"io\\\",\\\"statement_timeout\\\",\\\"serialization\\\",\\\"connection_lost\\\",\\\"artifact_changed\\\",\\\"lock_wait\\\",\\\"hydration\\\",\\\"artifact_transfer\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\",\\\"other\\\"], db_kind) && includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], db_route)\\n }\\n db_hash = string(f.db_hash) ?? \\\"\\\"\\n has_db_hash = exists(f.db_hash)\\n if db_ok {\\n if has_db_hash { db_ok = match(db_hash, r'^[0-9a-f]{64}$') && length(f) == 9 } else { db_ok = length(f) == 8 }\\n }\\n if db_ok {\\n db_event = {\\\"event\\\": \\\"node_warning\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"warn\\\", \\\"event_code\\\": \\\"db_failure_5xx\\\", \\\"status\\\": db_status, \\\"code\\\": db_code, \\\"service\\\": db_service, \\\"route\\\": db_route, \\\"elapsed_ms\\\": db_elapsed, \\\"failure_kind\\\": db_kind, \\\"write_may_have_applied\\\": bool!(f.write_may_have_applied)}\\n if has_db_hash { db_event.db_hash = db_hash }\\n }\\n }\\n # TC-2917: the node's periodic disk headroom line (one per local store) ships as an individual\\n # info event. Exactly the message plus `store` (a declared store) and `free_bytes` (a bounded\\n # integer in whole 64 MiB steps, as the node rounds it); anything else leaves headroom null, and\\n # the info line is then dropped below.\\n headroom = null\\n if target == \\\"tinycloud::disk_headroom\\\" && level == \\\"info\\\" && msg == \\\"storage headroom\\\" && length(f) == 3 {\\n h_store = string(f.store) ?? \\\"\\\"\\n h_free = f.free_bytes\\n if includes([\\\"sql\\\",\\\"duckdb\\\"], h_store) && is_integer(h_free) {\\n h_free = int!(h_free)\\n if h_free >= 0 && h_free <= 9007199254740991 && mod(h_free, 67108864) == 0 {\\n headroom = {\\\"event\\\": \\\"node_storage_headroom\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"store\\\": h_store, \\\"free_bytes\\\": h_free}\\n }\\n }\\n }\\n # TC-3973: ship the boot summary with exactly the seven bounded counters.\\n backfill = null\\n if target == \\\"tinycloud_core::models::delegation_mode\\\" && level == \\\"info\\\" && length(f) == 8 {\\n backfill_code = get({\\\"delegation mode boot reindex complete\\\":\\\"delegation_mode_boot_reindex_complete\\\",\\\"delegation mode boot reindex incomplete; skipped rows remain unmarked and derive on read\\\":\\\"delegation_mode_boot_reindex_incomplete\\\",\\\"delegation mode boot reindex incomplete (lock timeout); remaining rows derive on read\\\":\\\"delegation_mode_boot_reindex_lock_timeout\\\"}, [msg]) ?? null\\n if is_string(backfill_code) {\\n counters = {}\\n for_each([\\\"scanned\\\", \\\"reindexed_terminal\\\", \\\"marked_attenuable\\\", \\\"marked_invalid\\\", \\\"skipped_locked_pages\\\", \\\"skipped_decrypt_failed\\\", \\\"elapsed_ms\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n counters = set!(counters, [field], value)\\n }\\n }\\n if length(counters) == 7 {\\n backfill = merge(counters, {\\\"event\\\": \\\"delegation_mode_boot_reindex\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"event_code\\\": backfill_code})\\n }\\n }\\n }\\n # TC-4177: the deletion ledger's one line per start (target `tinycloud`, info) ships as an individual event. Either the\\n # message plus exactly `event`, `ledger_file` (a declared state), five bounded integer counts and `newest_deleted_at`\\n # (`none` or an RFC 3339 instant: digits, `T`, `:`, `.`, `Z`, `+`, `-` only), or the failure message plus exactly\\n # `event` and an `error_kind` from the ledger's fixed kinds. The message is never copied. Anything else leaves\\n # ledger_start null and the info line is dropped below.\\n ledger_start = null\\n if target == \\\"tinycloud\\\" && level == \\\"info\\\" && (string(f.event) ?? \\\"\\\") == \\\"deletion_ledger_start\\\" {\\n if msg == \\\"deletion ledger at start\\\" && length(f) == 9 {\\n ls_file = string(f.ledger_file) ?? \\\"\\\"\\n ls_newest = string(f.newest_deleted_at) ?? \\\"\\\"\\n if includes([\\\"missing\\\",\\\"empty\\\",\\\"present\\\"], ls_file) && match(ls_newest, r'^(none|\\\\d{4}-\\\\d{2}-\\\\d{2}[Tt]\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d{1,9})?([Zz]|[+-]\\\\d{2}:\\\\d{2}))$') {\\n ls_counts = {}\\n for_each([\\\"bytes\\\",\\\"operations\\\",\\\"key_entries\\\",\\\"committed\\\",\\\"aborted\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n ls_counts = set!(ls_counts, [field], value)\\n }\\n }\\n if length(ls_counts) == 5 {\\n ledger_start = merge(ls_counts, {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"ledger_file\\\": ls_file, \\\"newest_deleted_at\\\": ls_newest})\\n }\\n }\\n } else if msg == \\\"deletion ledger counts unavailable at start\\\" && length(f) == 3 {\\n ls_kind = string(f.error_kind) ?? \\\"\\\"\\n if includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], ls_kind) {\\n ledger_start = {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"error_kind\\\": ls_kind}\\n }\\n }\\n }\\n # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired\\n # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error\\n # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one\\n # of the ledger's fixed kinds. The message is never copied. Anything else leaves ledger null and the line falls back\\n # to the unclassified count below.\\n ledger = null\\n l_event = string(f.event) ?? \\\"\\\"\\n if level == \\\"error\\\" && includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], l_event) && exists(f.message) && length(f) == 3 {\\n l_target = get({\\\"deletion_ledger_open_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_replay_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_unrepaired\\\":\\\"tinycloud_core::encryption_network::deletion_ledger\\\"}, [l_event]) ?? \\\"\\\"\\n l_kind = string(f.error_kind) ?? \\\"\\\"\\n if target == l_target && includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], l_kind) {\\n ledger = {\\\"event\\\": l_event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"error\\\", \\\"error_kind\\\": l_kind}\\n }\\n }\\n if target == \\\"tinycloud::request\\\" && level == \\\"info\\\" && msg == \\\"request\\\" {\\n method = string!(f.method)\\n if includes([\\\"TRACE\\\", \\\"CONNECT\\\"], method) { method = \\\"\\\" }\\n route = string!(f.route)\\n canonical_route = get(aliases, [route]) ?? null\\n if is_string(canonical_route) { route = canonical_route }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = f.status\\n latency = f.latency_us\\n if !is_integer(status) || !is_integer(latency) { abort }\\n status = int!(status)\\n latency = int!(latency)\\n if status < 100 || status > 599 || latency < 0 || latency > 9007199254740991 { abort }\\n out = {\\\"event\\\": \\\"node_request\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"latency_us\\\": latency}\\n # N2 correlation fields: copied only when they have exactly the node's emitted shape; anything else is dropped\\n # (the event still ships). The pseudonyms are keyed HMAC-SHA256 digests, never raw identifiers.\\n rid = string(f.request_id) ?? \\\"\\\"\\n if match(rid, r'^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') { out.request_id = rid }\\n replaced = f.request_id_replaced\\n if is_boolean(replaced) { out.request_id_replaced = replaced }\\n account = string(f.account_hash) ?? \\\"\\\"\\n if match(account, r'^[0-9a-f]{64}$') { out.account_hash = account }\\n space = string(f.space_hash) ?? \\\"\\\"\\n if match(space, r'^[0-9a-f]{64}$') { out.space_hash = space }\\n # TC-3834: the 5xx origin, on status 500 and above only, and only when it is exactly one of the declared codes;\\n # anything else is dropped (the event still ships). A closed vocabulary, never error text.\\n if status >= 500 {\\n error_code = string(f.error_code) ?? \\\"\\\"\\n if includes([\\\"db_error\\\",\\\"db_timeout\\\",\\\"db_busy\\\",\\\"req_timeout\\\",\\\"read_audit\\\",\\\"storage_io\\\",\\\"caveat_db\\\",\\\"read_tx_error\\\",\\\"key_ledger\\\",\\\"lifecycle\\\",\\\"registry_down\\\",\\\"cutover_fence\\\",\\\"kv_candidate\\\",\\\"engine_error\\\",\\\"encryption\\\",\\\"size_limit\\\",\\\"disk_headroom\\\",\\\"internal\\\"], error_code) { out.error_code = error_code }\\n }\\n # TC-3739: per-request DB accounting, on status below 400 only (4xx/5xx are the capped classes; DB-caused 5xx\\n # already carry elapsed_ms on db_failure_5xx). Copied only as plain numbers inside the canonical bounds; anything\\n # else is dropped (the event still ships). They are driver wall times and an attempt count, never identifiers.\\n if status < 400 {\\n pool_wait = f.pool_wait_ms\\n if is_float(pool_wait) || is_integer(pool_wait) {\\n pool_wait = to_float!(pool_wait)\\n if pool_wait >= 0.0 && pool_wait <= 86400000.0 { out.pool_wait_ms = pool_wait }\\n }\\n query_time = f.query_time_ms\\n if is_float(query_time) || is_integer(query_time) {\\n query_time = to_float!(query_time)\\n if query_time >= 0.0 && query_time <= 86400000.0 { out.query_time_ms = query_time }\\n }\\n query_count = f.query_count\\n if is_integer(query_count) {\\n query_count = int!(query_count)\\n if query_count >= 0 && query_count <= 9007199254740991 { out.query_count = query_count }\\n }\\n }\\n } else if is_object(db_event) {\\n out = db_event\\n } else if is_object(headroom) {\\n out = headroom\\n } else if is_object(backfill) {\\n out = backfill\\n } else if is_object(ledger_start) {\\n out = ledger_start\\n } else if is_object(ledger) {\\n out = ledger\\n } else {\\n if !includes([\\\"warn\\\", \\\"error\\\"], level) { abort }\\n code = \\\"unclassified\\\"\\n if target == \\\"tinycloud\\\" || starts_with(target, \\\"tinycloud::\\\") || target == \\\"tinycloud_core\\\" || starts_with(target, \\\"tinycloud_core::\\\") {\\n codes = {\\\"delegation mode boot backfill failed; unmarked rows derive on read\\\":\\\"delegation_mode_boot_backfill_failed\\\",\\\"delegation mode boot reindex skipped rows that failed decryption; leaving unmarked for read-time fail-closed handling\\\":\\\"delegation_mode_boot_reindex_decrypt_failed\\\",\\\"invocation replay insert failed\\\":\\\"invocation_replay_insert_failed\\\",\\\"invocation replay cleanup failed\\\":\\\"invocation_replay_cleanup_failed\\\",\\\"share-v2 local-tee feature active: deriving a deterministic, non-attested TEE identity from node key material\\\":\\\"share_local_tee_identity\\\",\\\"retention: delivered hook delivery prune failed\\\":\\\"retention_hook_delivery_prune_failed\\\",\\\"retention: dead-letter hook delivery prune failed\\\":\\\"retention_dead_letter_prune_failed\\\",\\\"retention: signed KV ticket prune failed\\\":\\\"retention_signed_ticket_prune_failed\\\",\\\"failed to load tunnel state; tunnel not started\\\":\\\"tunnel_state_load_failed\\\",\\\"invalid loopback API address; tunnel not started\\\":\\\"tunnel_address_invalid\\\",\\\"failed to load link state; LAN listener not started\\\":\\\"link_state_load_failed\\\",\\\"invalid link bind address; LAN listener not started\\\":\\\"link_bind_invalid\\\",\\\"invalid loopback API address; LAN listener not started\\\":\\\"link_address_invalid\\\",\\\"failed to bind link LAN listener; LAN listener not started\\\":\\\"link_bind_failed\\\",\\\"failed to build TLS config; LAN listener not started\\\":\\\"link_tls_config_failed\\\",\\\"link LAN listener exited with error\\\":\\\"link_listener_error\\\",\\\"failed to record link listener bind state\\\":\\\"link_listener_state_write_failed\\\",\\\"failed to record link listener bind failure\\\":\\\"link_bind_state_write_failed\\\",\\\"failed to load config for auto-renew\\\":\\\"link_auto_renew_config_failed\\\",\\\"link auto-renew failed\\\":\\\"link_auto_renew_failed\\\",\\\"failed to hot-reload renewed link cert\\\":\\\"link_cert_reload_failed\\\",\\\"link auto-renew succeeded but no state.json found; skipping cert hot-reload\\\":\\\"link_cert_state_missing\\\",\\\"failed to reload TLS material after link auto-renew\\\":\\\"link_listener_cert_reload_failed\\\",\\\"link disable: service delete failed; local state removed anyway\\\":\\\"link_disable_failed\\\",\\\"link connection error\\\":\\\"link_connection_error\\\",\\\"link listener accept error\\\":\\\"link_listener_accept_failed\\\",\\\"webhook delivery attempt failed\\\":\\\"webhook_delivery_failed\\\",\\\"webhook dispatcher loop failed\\\":\\\"webhook_dispatcher_failed\\\",\\\"addressed delegation authorization failed\\\":\\\"share_authorization_failed\\\",\\\"native share authorization denied\\\":\\\"share_native_authorization_denied\\\",\\\"native share KV put failed\\\":\\\"share_native_kv_put_failed\\\",\\\"share v2 readiness probe failed\\\":\\\"share_v2_readiness_failed\\\",\\\"share v2 is enabled but shareEmail.invitationPublicKey is unset\\\":\\\"share_invitation_key_missing\\\",\\\"configured share invitation key does not match the node's derived signing key\\\":\\\"share_invitation_key_mismatch\\\",\\\"share/v2 policy challenge denied\\\":\\\"share_policy_denied\\\",\\\"failed to read committed hook events\\\":\\\"hook_events_read_failed\\\",\\\"failed to load kv write hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"failed to load kv delete hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"missing committed kv hook row for invocation\\\":\\\"missing_committed_hook_row\\\",\\\"database write committed but webhook enqueue failed\\\":\\\"webhook_enqueue_failed\\\",\\\"tunnel: failed to prepare connection attempt\\\":\\\"tunnel_connection_prepare_failed\\\",\\\"tunnel: no frame within idle timeout; treating connection as dead\\\":\\\"tunnel_idle_timeout\\\",\\\"tunnel: read error\\\":\\\"tunnel_read_failed\\\",\\\"tunnel: dropping malformed frame\\\":\\\"tunnel_malformed_frame\\\",\\\"tunnel: relay sent an error frame\\\":\\\"tunnel_relay_error\\\",\\\"tunnel: failed to write frame\\\":\\\"tunnel_write_failed\\\",\\\"tunnel: failed to record runtime state\\\":\\\"tunnel_state_record_failed\\\",\\\"tunnel: failed to clear runtime state after disable\\\":\\\"tunnel_state_clear_failed\\\",\\\"tunnel authentication rejected\\\":\\\"tunnel_auth_rejected\\\",\\\"network DID resolution enabled: did:web/did:tz fetches use the unhardened ssi client (TC-1080)\\\":\\\"network_did_resolution_enabled\\\",\\\"SQL busy: lock wait\\\":\\\"sql_busy_lock_wait\\\",\\\"SQL busy: hydration\\\":\\\"sql_busy_hydration\\\",\\\"SQL busy: artifact transfer\\\":\\\"sql_busy_artifact_transfer\\\",\\\"Request deadline exceeded\\\":\\\"request_timeout\\\",\\\"Request completed after its deadline\\\":\\\"deadline_overrun\\\",\\\"Database hydration gave up loading its artifact\\\":\\\"sql_hydration_timeout\\\",\\\"Read audit wait expired\\\":\\\"read_audit_busy\\\",\\\"Read audit batch slow\\\":\\\"read_audit_batch_slow\\\",\\\"Read audit batch failed\\\":\\\"read_audit_batch_failed\\\",\\\"Read audit drain stalled\\\":\\\"read_audit_drain_stalled\\\",\\\"retrying operation after a lost database connection\\\":\\\"db_operation_retried\\\",\\\"not retrying operation: its first run took longer than the retry window to fail\\\":\\\"db_operation_retry_skipped_slow\\\",\\\"idx_current_kv_space_deleted_key_c is missing; the node keeps serving and KV list requests are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_current_kv_space_deleted_key_c)\\\":\\\"current_kv_c_index_missing\\\",\\\"idx_current_kv_space_deleted_key_c is invalid or still being built; the node keeps serving and KV list requests are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_invalid\\\",\\\"idx_current_kv_space_deleted_key_c exists with the wrong definition and is not used for KV lists; the node keeps serving and KV list requests are slower. Run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_wrong_shape\\\",\\\"idx_kv_write_space_value is missing; the node keeps serving and KV writes that attach a blob are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_kv_write_space_value)\\\":\\\"kv_write_value_index_missing\\\",\\\"idx_kv_write_space_value is invalid or still being built; the node keeps serving and KV writes that attach a blob are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_invalid\\\",\\\"idx_kv_write_space_value exists with the wrong definition and is not used for blob reference checks; the node keeps serving and KV writes that attach a blob are slower. Run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_wrong_shape\\\",\\\"request answered with a 5xx\\\":\\\"http_5xx\\\",\\\"chain guard wait exceeded the slow-wait threshold\\\":\\\"chain_guard_slow_wait\\\",\\\"kv head size probe failed; size omitted\\\":\\\"kv_head_size_probe_failed\\\",\\\"Database checkpoint save failed; refusing its writes until the back-off ends\\\":\\\"sql_checkpoint_save_backoff\\\",\\\"Database exceeds the artifact read limit; not loaded\\\":\\\"sql_database_too_large_to_load\\\",\\\"Database checkpoint exceeds the artifact write limit; not saved\\\":\\\"sql_checkpoint_too_large\\\",\\\"Database checkpoint shrank sharply against the artifact it replaces\\\":\\\"sql_checkpoint_shrank\\\",\\\"Database artifact storage unavailable\\\":\\\"sql_artifact_storage_unavailable\\\",\\\"Database artifact kept changing while it was read\\\":\\\"sql_artifact_changed_during_read\\\",\\\"Artifact part integrity check failed\\\":\\\"artifact_part_hash_mismatch\\\",\\\"Artifact part collection deferred\\\":\\\"artifact_part_collection_deferred\\\",\\\"Durable database artifact does not carry the expected file header; refusing to hydrate\\\":\\\"artifact_header_invalid\\\",\\\"No recorded artifact lineage for a live database; saving without a lineage assertion\\\":\\\"artifact_lineage_missing\\\",\\\"No recorded artifact lineage for a live database; discarding the actor\\\":\\\"artifact_lineage_missing_discarded\\\",\\\"Failed to open database\\\":\\\"database_open_failed\\\",\\\"Failed to promote database to file\\\":\\\"database_promote_failed\\\",\\\"Not enough free disk to promote a database; keeping it in memory\\\":\\\"database_promote_no_disk\\\",\\\"failed to copy view during table copy\\\":\\\"duckdb_view_copy_failed\\\",\\\"Database cache cleanup failed\\\":\\\"duckdb_cache_cleanup_failed\\\",\\\"sql ddl allowed without schema ability (ddl_requires_schema = log)\\\":\\\"sql_ddl_without_schema\\\",\\\"Local SQL commit failed\\\":\\\"sql_commit_failed\\\",\\\"Dead SQL actor detected, respawning\\\":\\\"sql_actor_respawned\\\",\\\"Dead SQL actor detected during export, removing\\\":\\\"sql_actor_dead_on_export\\\",\\\"sql_store shadow upload blocked for a database\\\":\\\"shadow_upload_blocked\\\",\\\"sql_store shadow could not read a manifest row\\\":\\\"shadow_manifest_read_failed\\\",\\\"sql_store shadow lag scan failed\\\":\\\"shadow_lag_scan_failed\\\",\\\"sql_store shadow drained behind PG\\\":\\\"shadow_drained_behind_pg\\\",\\\"database connection lost\\\":\\\"db_connection_lost\\\",\\\"retries suppressed after a database overload signal\\\":\\\"db_retries_suppressed\\\",\\\"not retrying operation: retries are suppressed after a database overload signal\\\":\\\"db_operation_retry_suppressed\\\",\\\"not retrying operation: the request deadline leaves no room\\\":\\\"db_operation_retry_no_deadline\\\",\\\"retry attempt stopped: the operation budget expired\\\":\\\"db_operation_retry_budget_spent\\\",\\\"Read audit batch timed out\\\":\\\"read_audit_batch_timeout\\\",\\\"failed to refund orphaned KV blob; periodic collector will retry\\\":\\\"kv_blob_refund_failed\\\",\\\"a deleting fence named a blob that a committed write references; it was closed without deleting the blob\\\":\\\"kv_blob_delete_skipped_referenced\\\",\\\"KV orphan collection failed\\\":\\\"kv_orphan_collection_failed\\\",\\\"delegate epoch path failed\\\":\\\"delegate_epoch_path_failed\\\",\\\"epoch insert failed\\\":\\\"epoch_insert_failed\\\",\\\"epoch head backfill stopped at its first error; writes stay correct and repair each space on its next write\\\":\\\"epoch_head_backfill_failed\\\",\\\"invocation referenced a space absent from the database\\\":\\\"invocation_space_missing\\\",\\\"deletion ledger is locked by another process: waiting for it\\\":\\\"deletion_ledger_lock_wait\\\",\\\"deletion ledger replayed at start\\\":\\\"deletion_ledger_replayed\\\",\\\"deletion ledger: committed line was not written\\\":\\\"deletion_ledger_commit_unwritten\\\",\\\"deletion ledger: could not tell whether a delete committed; the operation stays open\\\":\\\"deletion_ledger_commit_unknown\\\",\\\"deletion ledger: the settling line was not written\\\":\\\"deletion_ledger_settle_unwritten\\\",\\\"could not record losing network create ceremony as failed\\\":\\\"network_create_ceremony_mark_failed\\\",\\\"share scope validation failed\\\":\\\"share_scope_validation_failed\\\",\\\"delivery authorization refused\\\":\\\"delivery_authorization_refused\\\",\\\"delivery authorizations refused by the rate limit\\\":\\\"delivery_rate_limited\\\",\\\"deactivated webhook subscriptions; owners must re-register\\\":\\\"hook_subscriptions_deactivated\\\",\\\"webhook egress closed: internal endpoint refresh failed\\\":\\\"webhook_egress_refresh_failed\\\",\\\"webhook egress closed: internal endpoint lookup failed\\\":\\\"webhook_egress_lookup_failed\\\",\\\"webhook delivery mark refused: lease no longer held\\\":\\\"webhook_mark_lease_lost\\\",\\\"webhook delivery lease release failed\\\":\\\"webhook_lease_release_failed\\\",\\\"webhook delivery send skipped: lease no longer held\\\":\\\"webhook_send_lease_lost\\\",\\\"internal renewal scheduler pass failed\\\":\\\"renewal_scheduler_tick_failed\\\",\\\"renewals paused node-wide\\\":\\\"renewals_paused\\\",\\\"renewals resumed node-wide\\\":\\\"renewals_resumed\\\",\\\"the links API clock differs from the node clock\\\":\\\"links_read_clock_skew\\\",\\\"purge ledger reconciliation failed; space traffic stays refused\\\":\\\"space_purge_reconcile_failed\\\",\\\"space purge residue sweep failed\\\":\\\"space_purge_sweep_failed\\\",\\\"space purge phase failed; retrying later\\\":\\\"space_purge_phase_failed\\\",\\\"space purge attempt release failed\\\":\\\"space_purge_release_failed\\\",\\\"space purge claim failed\\\":\\\"space_purge_claim_failed\\\",\\\"owner erasure pass failed; retrying later\\\":\\\"owner_erasure_pass_failed\\\",\\\"skipped invalid space directories while measuring storage\\\":\\\"storage_invalid_space_dirs\\\",\\\"removed setting is set and ignored; delete it from the configuration\\\":\\\"removed_setting_ignored\\\",\\\"admin stats result exceeds its bound\\\":\\\"admin_stats_over_bound\\\",\\\"admin stats query failed\\\":\\\"admin_stats_query_failed\\\",\\\"TDX quote unavailable\\\":\\\"attestation_quote_unavailable\\\",\\\"dstack guest agent returned an error\\\":\\\"dstack_guest_agent_error\\\",\\\"tunnel: failed to build upstream HTTP client\\\":\\\"tunnel_upstream_client_failed\\\"}\\n known = get(codes, [msg]) ?? null\\n if is_string(known) { code = known }\\n if starts_with(msg, \\\"quota service returned \\\") { code = \\\"quota_fallback\\\" }\\nif starts_with(msg, \\\"Failed to get TDX quote: \\\") { code = \\\"attestation_quote_failed\\\" }\\nif starts_with(msg, \\\"created a new node identity at \\\") { code = \\\"node_identity_created\\\" }\\nif starts_with(msg, \\\"quota service returned an invalid body: \\\") { code = \\\"quota_invalid_body\\\" }\\nif starts_with(msg, \\\"dstack socket available but get_info failed: \\\") { code = \\\"dstack_get_info_failed\\\" }\\n # TC-3284: a line with no message is named by its constant `event` field, only when that event is listed.\\n if msg == \\\"\\\" && !exists(f.message) {\\n events = {\\\"did_resolution_refused\\\":\\\"did_resolution_refused\\\",\\\"renewal_scheduler_lease_failed\\\":\\\"renewal_scheduler_lease_failed\\\",\\\"session_retire_failed\\\":\\\"session_retire_failed\\\"}\\n named = get(events, [string(f.event) ?? \\\"\\\"]) ?? null\\n if is_string(named) { code = named }\\n }\\n }\\n if level == \\\"warn\\\" && target == \\\"rocket::config::config\\\" && msg == \\\"found value for deprecated config key `log`\\\" { code = \\\"rocket_deprecated_log_config\\\" }\\nif level == \\\"warn\\\" && target == \\\"rocket::launch\\\" && starts_with(msg, \\\"Rocket has launched from \\\") { code = \\\"rocket_launched\\\" }\\n event = if level == \\\"warn\\\" { \\\"node_warning\\\" } else { \\\"node_error\\\" }\\n out = {\\\"event\\\": event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": level, \\\"event_code\\\": code, \\\"event_count\\\": 1}\\n }\\n} else {\\n ts = string!(j.time)\\n method = string!(j.method)\\n route = string!(j.route)\\n if route == \\\"\\\" { route = \\\"\\\" }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = j.status\\n request_time = j.request_time\\n if !is_integer(status) || !(is_integer(request_time) || is_float(request_time)) { abort }\\n status = int!(status)\\n request_time = to_float!(request_time)\\n if status < 100 || status > 599 || request_time < 0 || request_time > 86400 { abort }\\n out = {\\\"event\\\": \\\"ingress_request\\\", \\\"svc\\\": \\\"ingress\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"request_time_seconds\\\": request_time}\\n}\\nif length(ts) > 64 { abort }\\nparsed_ts = parse_timestamp!(ts, format: \\\"%+\\\")\\nout.ts = format_timestamp!(parsed_ts, format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\")\\n. = out\\n\",\"drop_on_error\":true,\"drop_on_abort\":true,\"reroute_dropped\":true},\"gate_counts\":{\"type\":\"remap\",\"inputs\":[\"gate_route.rejected\",\"gate_route._unmatched\",\"allowlist.dropped\",\"event_route._unmatched\"],\"source\":\"reason = .reason\\nif !includes([\\\"malformed_envelope\\\",\\\"unexpected_label\\\",\\\"unlabelled\\\",\\\"non_json\\\",\\\"oversized\\\",\\\"partial\\\",\\\"invalid_fields\\\",\\\"unknown_target\\\",\\\"filtered_level\\\"], reason) { reason = \\\"invalid_fields\\\" }\\n. = {\\\"reason\\\": reason, \\\"count\\\": 1}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_reduce\":{\"type\":\"reduce\",\"inputs\":[\"gate_counts\"],\"group_by\":[\"reason\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"count\":\"sum\"}},\"gate_output\":{\"type\":\"remap\",\"inputs\":[\"gate_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": \\\"warn\\\", \\\"event\\\": \\\"logship_gate_summary_total\\\", \\\"svc\\\": \\\"logship\\\", \\\"reason\\\": .reason, \\\"count\\\": .count}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"request_profile\":{\"type\":\"filter\",\"inputs\":[\"allowlist\"],\"condition\":\"\\\"$${TINYCLOUD_LOGSHIP_PROFILE}\\\" == \\\"all_requests\\\" || includes([\\\"node_warning\\\",\\\"node_error\\\",\\\"node_storage_headroom\\\",\\\"delegation_mode_boot_reindex\\\",\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\",\\\"deletion_ledger_start\\\"], .event) || (int(.status) ?? 0) >= 400 || (.event == \\\"node_request\\\" && (int(.latency_us) ?? 0) > 1000000) || (.event == \\\"ingress_request\\\" && (to_float(.request_time_seconds) ?? 0.0) > 1.000000)\"},\"event_route\":{\"type\":\"route\",\"inputs\":[\"request_profile\"],\"route\":{\"request\":\"(.event == \\\"node_request\\\" || .event == \\\"ingress_request\\\") && !(((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)) && !((int(.status) ?? 0) >= 500)\",\"node_request_5xx\":\".event == \\\"node_request\\\" && (int(.status) ?? 0) >= 500\",\"ingress_request_5xx\":\".event == \\\"ingress_request\\\" && (int(.status) ?? 0) >= 500\",\"node_request_4xx\":\".event == \\\"node_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"ingress_request_4xx\":\".event == \\\"ingress_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"db_failure_5xx\":\".event == \\\"node_warning\\\" && .event_code == \\\"db_failure_5xx\\\"\",\"storage_headroom\":\".event == \\\"node_storage_headroom\\\"\",\"delegation_mode_boot_reindex\":\".event == \\\"delegation_mode_boot_reindex\\\"\",\"deletion_ledger\":\"includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event)\",\"deletion_ledger_start\":\".event == \\\"deletion_ledger_start\\\"\",\"diagnostic\":\"(.event == \\\"node_warning\\\" && .event_code != \\\"db_failure_5xx\\\") || .event == \\\"node_error\\\"\"}},\"cap_db_failure_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.db_failure_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"db_failure_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"diagnostic_reduce\":{\"type\":\"reduce\",\"inputs\":[\"event_route.diagnostic\"],\"group_by\":[\"event\",\"event_code\",\"level\",\"svc\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"event_count\":\"sum\",\"ts\":\"discard\"}},\"diagnostic_output\":{\"type\":\"remap\",\"inputs\":[\"diagnostic_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": .level, \\\"event\\\": .event, \\\"svc\\\": \\\"api\\\", \\\"event_code\\\": .event_code, \\\"event_count\\\": .event_count}\",\"drop_on_error\":true,\"drop_on_abort\":true}},\"sinks\":{\"betterstack\":{\"type\":\"http\",\"inputs\":[\"event_route.request\",\"event_route.storage_headroom\",\"event_route.delegation_mode_boot_reindex\",\"event_route.deletion_ledger\",\"event_route.deletion_ledger_start\",\"cap_db_failure_5xx\",\"cap_node_request_5xx\",\"cap_ingress_request_5xx\",\"cap_node_request_4xx\",\"cap_ingress_request_4xx\",\"diagnostic_output\",\"gate_output\"],\"method\":\"post\",\"uri\":\"https://s2795437.us-west-2a.betterstackdata.com/\",\"encoding\":{\"codec\":\"json\"},\"framing\":{\"method\":\"newline_delimited\"},\"compression\":\"gzip\",\"auth\":{\"strategy\":\"bearer\",\"token\":\"SECRET[bs.bs_token]\"},\"batch\":{\"max_bytes\":262144,\"timeout_secs\":1},\"buffer\":{\"type\":\"memory\",\"max_events\":1000,\"when_full\":\"block\"},\"request\":{\"timeout_secs\":10,\"retry_max_duration_secs\":300},\"healthcheck\":{\"enabled\":false}}},\"secret\":{\"bs\":{\"type\":\"directory\",\"path\":\"/var/lib/vector/secrets\",\"remove_trailing_whitespace\":true}}}" entrypoint: - /bin/sh - -ec diff --git a/scripts/tc959-logship.mjs b/scripts/tc959-logship.mjs index 0a42a28f..12ad878b 100644 --- a/scripts/tc959-logship.mjs +++ b/scripts/tc959-logship.mjs @@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url'; import { resolve } from 'node:path'; import { vectorTests, requestProfileTests } from '../log-shipper/cases.mjs'; import { CAPPED_CLASSES, CAP_WINDOW_SECONDS } from '../log-shipper/budget.mjs'; -import { LEDGER_EVENTS, LEDGER_ERROR_KINDS, LEDGER_TARGETS } from '../log-shipper/ledger.mjs'; +import { LEDGER_EVENTS, LEDGER_ERROR_KINDS, LEDGER_TARGETS, LEDGER_START_EVENT, LEDGER_START_TARGET, LEDGER_START_MESSAGE, LEDGER_START_FAILED_MESSAGE, LEDGER_START_FILES, LEDGER_START_COUNTERS } from '../log-shipper/ledger.mjs'; const root = fileURLToPath(new URL('../', import.meta.url)); const load = name => JSON.parse(readFileSync(resolve(root, 'log-shipper', name), 'utf8')); @@ -76,6 +76,12 @@ export function buildConfig({ sinkUri = 'https://s2795437.us-west-2a.betterstack .replaceAll('__LEDGER_EVENTS__', JSON.stringify(LEDGER_EVENTS)) .replaceAll('__LEDGER_ERROR_KINDS__', JSON.stringify(LEDGER_ERROR_KINDS)) .replaceAll('__LEDGER_TARGETS__', JSON.stringify(LEDGER_TARGETS)) + .replaceAll('__LEDGER_START_TARGET__', JSON.stringify(LEDGER_START_TARGET)) + .replaceAll('__LEDGER_START_EVENT__', JSON.stringify(LEDGER_START_EVENT)) + .replaceAll('__LEDGER_START_MESSAGE__', JSON.stringify(LEDGER_START_MESSAGE)) + .replaceAll('__LEDGER_START_FAILED_MESSAGE__', JSON.stringify(LEDGER_START_FAILED_MESSAGE)) + .replaceAll('__LEDGER_START_FILES__', JSON.stringify(LEDGER_START_FILES)) + .replaceAll('__LEDGER_START_COUNTERS__', JSON.stringify(LEDGER_START_COUNTERS)) .replace('__ROUTE_ALIASES__', JSON.stringify(aliases)) .replace('__BOOT_REINDEX_CODES__', JSON.stringify(diagnostics.boot_reindex)) .replace('__SCOPED_DIAGNOSTICS__', diagnostics.scoped.map(({ target, message, prefix, code }) => { @@ -127,9 +133,11 @@ if reason != "" { else { target = string(parsed.target) ?? "" level = downcase(string(parsed.level) ?? "") + gate_fields = object(parsed.fields) ?? {} + gate_event = string(gate_fields.event) ?? "" if label == "tinycloud-node" && !includes(["warn", "error"], level) && target != "tinycloud" && !starts_with(target, "tinycloud::") && target != "tinycloud_core" && !starts_with(target, "tinycloud_core::") { . = {"reason": "unknown_target"} - } else if label == "tinycloud-node" && !includes(["warn", "error"], level) && !((target == "tinycloud::request" || target == "tinycloud::disk_headroom" || target == "tinycloud_core::models::delegation_mode") && level == "info") { + } else if label == "tinycloud-node" && !includes(["warn", "error"], level) && !((target == "tinycloud::request" || target == "tinycloud::disk_headroom" || target == "tinycloud_core::models::delegation_mode" || (target == ${JSON.stringify(LEDGER_START_TARGET)} && gate_event == ${JSON.stringify(LEDGER_START_EVENT)})) && level == "info") { . = {"reason": "filtered_level"} } else { . = {"label": label, "parsed": parsed} } } @@ -142,7 +150,7 @@ if !includes(${JSON.stringify(schema.fields.reason.values)}, reason) { reason = . = {"reason": reason, "count": 1}`), gate_reduce: { type: 'reduce', inputs: ['gate_counts'], group_by: ['reason'], end_every_period_ms: 60000, expire_after_ms: 75000, flush_period_ms: 1000, merge_strategies: { count: 'sum' } }, gate_output: remap(['gate_reduce'], `. = {"ts": format_timestamp!(now(), format: "%Y-%m-%dT%H:%M:%S%.3fZ"), "level": "warn", "event": "logship_gate_summary_total", "svc": "logship", "reason": .reason, "count": .count}`), - request_profile: { type: 'filter', inputs: ['allowlist'], condition: `${profileExpression} == "all_requests" || includes(${JSON.stringify(['node_warning', 'node_error', 'node_storage_headroom', 'delegation_mode_boot_reindex', ...LEDGER_EVENTS])}, .event) || (int(.status) ?? 0) >= 400 || (.event == "node_request" && (int(.latency_us) ?? 0) > ${slowThresholdUs}) || (.event == "ingress_request" && (to_float(.request_time_seconds) ?? 0.0) > ${(slowThresholdUs / 1000000).toFixed(6)})` }, + request_profile: { type: 'filter', inputs: ['allowlist'], condition: `${profileExpression} == "all_requests" || includes(${JSON.stringify(['node_warning', 'node_error', 'node_storage_headroom', 'delegation_mode_boot_reindex', ...LEDGER_EVENTS, LEDGER_START_EVENT])}, .event) || (int(.status) ?? 0) >= 400 || (.event == "node_request" && (int(.latency_us) ?? 0) > ${slowThresholdUs}) || (.event == "ingress_request" && (to_float(.request_time_seconds) ?? 0.0) > ${(slowThresholdUs / 1000000).toFixed(6)})` }, // The 5xx diagnostic (TC-1840) is an individual event: it bypasses the count reducer, which would drop its fields. // The five capped classes (TC-1843) each have their own route; request events below status 400 (slow 1xx-3xx // requests, and every request under all_requests) stay on `request`, unsampled. @@ -158,6 +166,8 @@ if !includes(${JSON.stringify(schema.fields.reason.values)}, reason) { reason = delegation_mode_boot_reindex: '.event == "delegation_mode_boot_reindex"', // TC-3284: the deletion ledger's error events ship as is: at most one of each per process, no cap or reducer. deletion_ledger: `includes(${JSON.stringify(LEDGER_EVENTS)}, .event)`, + // TC-4177: the deletion ledger's one start line ships as is: once per process, no cap or reducer. + deletion_ledger_start: `.event == ${JSON.stringify(LEDGER_START_EVENT)}`, diagnostic: '(.event == "node_warning" && .event_code != "db_failure_5xx") || .event == "node_error"', } }, ...Object.fromEntries(Object.entries(CAPPED_CLASSES).map(([name, { capPerMinute }]) => [capName(name), capTransform(name, capPerMinute)])), @@ -165,7 +175,7 @@ if !includes(${JSON.stringify(schema.fields.reason.values)}, reason) { reason = diagnostic_output: remap(['diagnostic_reduce'], `. = {"ts": format_timestamp!(now(), format: "%Y-%m-%dT%H:%M:%S%.3fZ"), "level": .level, "event": .event, "svc": "api", "event_code": .event_code, "event_count": .event_count}`), }, sinks: { betterstack: { - type: 'http', inputs: ['event_route.request', 'event_route.storage_headroom', 'event_route.delegation_mode_boot_reindex', 'event_route.deletion_ledger', ...Object.keys(CAPPED_CLASSES).map(capName), 'diagnostic_output', 'gate_output'], method: 'post', uri: sinkUri, + type: 'http', inputs: ['event_route.request', 'event_route.storage_headroom', 'event_route.delegation_mode_boot_reindex', 'event_route.deletion_ledger', 'event_route.deletion_ledger_start', ...Object.keys(CAPPED_CLASSES).map(capName), 'diagnostic_output', 'gate_output'], method: 'post', uri: sinkUri, encoding: { codec: 'json' }, framing: { method: 'newline_delimited' }, compression: 'gzip', auth: { strategy: 'bearer', token: token ?? 'SECRET[bs.bs_token]' }, batch: { max_bytes: 262144, timeout_secs: 1 }, diff --git a/tinycloud-core/src/duckdb/database.rs b/tinycloud-core/src/duckdb/database.rs index 9c0dc0fb..e9025229 100644 --- a/tinycloud-core/src/duckdb/database.rs +++ b/tinycloud-core/src/duckdb/database.rs @@ -507,10 +507,9 @@ fn deregister_actor( cleanup::MovedAside::default() }; if cleanup::delete_aside(cleanup::release(entry, moved)) { - // Value-free event for a local debug-log check of cache-disk headroom. It is `debug!` - // on purpose: the log shipper names and ships only warn/error lines, and this one has - // no event_code in the pinned schema (a follow-up adds one and promotes it). - tracing::debug!( + // Value-free: no path or error text, so the log shipper can name it. It ships as the + // counted diagnostic `duckdb_cache_cleanup_failed` (log-shipper/diagnostics.json, TC-4190). + tracing::warn!( event = "duckdb_cache_cleanup_failed", "Database cache cleanup failed" ); From 1e9aa4741f890d8ee65cd66b1dda7a01273486b0 Mon Sep 17 00:00:00 2001 From: "tinycloud-bot[bot]" <348376441+tinycloud-bot[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 12:54:56 +0000 Subject: [PATCH 2/5] log-shipper: rule profile.test.mjs for the deletion_ledger_start route (TC-4177) - Test-ruling TC-4177 (Naomi, 12:55Z): the existing assertion gains the new entry; equality kept, nothing removed. Details: TC-4177 --- log-shipper/profile.test.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/log-shipper/profile.test.mjs b/log-shipper/profile.test.mjs index 530db00c..db4f82ca 100644 --- a/log-shipper/profile.test.mjs +++ b/log-shipper/profile.test.mjs @@ -25,9 +25,9 @@ test('the real sink receives the uncapped requests, the five cap transforms, the for (const profile of ['errors_slow', 'all_requests']) { const { sinks, transforms } = buildConfig({ profile }); // test-ruling: TC-3284 log-shipper/profile.test.mjs sink inputs and route keys gain deletion_ledger (2026-11-22) - assert.deepEqual(sinks.betterstack.inputs, ['event_route.request', 'event_route.storage_headroom', 'event_route.delegation_mode_boot_reindex', 'event_route.deletion_ledger', 'cap_db_failure_5xx', 'cap_node_request_5xx', 'cap_ingress_request_5xx', 'cap_node_request_4xx', 'cap_ingress_request_4xx', 'diagnostic_output', 'gate_output']); + assert.deepEqual(sinks.betterstack.inputs, ['event_route.request', 'event_route.storage_headroom', 'event_route.delegation_mode_boot_reindex', 'event_route.deletion_ledger', 'event_route.deletion_ledger_start', 'cap_db_failure_5xx', 'cap_node_request_5xx', 'cap_ingress_request_5xx', 'cap_node_request_4xx', 'cap_ingress_request_4xx', 'diagnostic_output', 'gate_output']); // test-ruling: TC-4177 log-shipper/profile.test.mjs:28 sink inputs gain event_route.deletion_ledger_start (2026-11-24) assert.deepEqual(transforms.diagnostic_reduce.inputs, ['event_route.diagnostic']); - assert.deepEqual(Object.keys(transforms.event_route.route), ['request', 'node_request_5xx', 'ingress_request_5xx', 'node_request_4xx', 'ingress_request_4xx', 'db_failure_5xx', 'storage_headroom', 'delegation_mode_boot_reindex', 'deletion_ledger', 'diagnostic']); + assert.deepEqual(Object.keys(transforms.event_route.route), ['request', 'node_request_5xx', 'ingress_request_5xx', 'node_request_4xx', 'ingress_request_4xx', 'db_failure_5xx', 'storage_headroom', 'delegation_mode_boot_reindex', 'deletion_ledger', 'deletion_ledger_start', 'diagnostic']); // test-ruling: TC-4177 log-shipper/profile.test.mjs:30 route keys gain deletion_ledger_start (2026-11-24) assert.match(transforms.event_route.route.diagnostic, /event_code != "db_failure_5xx"/); } }); From 5a95c4da9643e5f5e2fb4f6a182a9f3cf890a20d Mon Sep 17 00:00:00 2001 From: "tinycloud-bot[bot]" <348376441+tinycloud-bot[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 02:18:51 +0000 Subject: [PATCH 3/5] log-shipper: fold the four TC-1491 P4.2a event codes into the TC-4177 bundle; recompute N0 template hash - fields.json: event_code gains store_master_mode_unreadable_refused, store_master_backstop_rotation_failed, shadow_local_working_copy_missing, shadow_local_read_failed (schema dev-sam 764c32a9, fields.json sha256 9abea684...). - diagnostics.json: four exact message entries for them (messages arrive with node #756; coverage and the ledger test do not require an emitter). - Compose VECTOR_CONFIG_JSON and the N0 fixture regenerated; n0_template_hash 693f06e86e0ea576a435b891214e9aaf528204c66131d85f53b4a805f8c47a60 (raw ef81b59ff3034ff17c049ac281173c4ac69ee8036f4d6333b19ed260c60e71b9). - New test in log-shipper/ledger-start.test.mjs for the four mappings. Details: TC-4177 --- .github/workflows/docker.yml | 4 ++-- CHANGELOG.md | 2 +- docker-compose.dstack-postgres.yaml | 2 +- docs/releasing.md | 6 +++--- log-shipper/canonical.json | 4 ++-- log-shipper/diagnostics.json | 4 ++++ log-shipper/fields.json | 2 +- log-shipper/ledger-start.test.mjs | 14 ++++++++++++++ scripts/ci/fixtures/tc959-n0-compose.yaml | 2 +- 9 files changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 07baa329..e72fbd16 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -836,13 +836,13 @@ jobs: # free-disk env lines, the TC-3739 node_request DB timing fields, the TC-3834 node_request # error_code, the TC-3284 deletion ledger error events and the TC-3284 named node diagnostics and the TC-3973 startup events and the TC-4177 deletion ledger start line and the TC-4190 duckdb_cache_cleanup_failed code in the Vector config # and the TC-4194 cloudflared connector service (optional CLOUDFLARE_TUNNEL_TOKEN; no published ports; own cf-edge network shared only with tinycloud) - # (raw fdcf54f2…, with TC-4177 and TC-4190; a52a126d… / a6902dd5… before them; 68f00873… / 91802e6c… before the TC-4249 ingress pin; 7cc95bde… / 8c8785fb… before TC-4194; e0f99bcc… / a8fb25f7… before TC-3973; 97a180a4… / bced82d3… before the named diagnostics, db348152… / 27287a38… before TC-3284, cc219eb5… / 02d90755… before TC-3834, c6d05e1e… / 46287bc3… before TC-3739, + # (raw ef81b59f…, with TC-4177, TC-4190 and the four TC-1491 P4.2a codes; a52a126d… / a6902dd5… before them; 68f00873… / 91802e6c… before the TC-4249 ingress pin; 7cc95bde… / 8c8785fb… before TC-4194; e0f99bcc… / a8fb25f7… before TC-3973; 97a180a4… / bced82d3… before the named diagnostics, db348152… / 27287a38… before TC-3284, cc219eb5… / 02d90755… before TC-3834, c6d05e1e… / 46287bc3… before TC-3739, # e5f1c356… / d1d2ef49… before the TC-1491 caps, # e1cf031b… / f4f51e75… before TC-1791, 6a577c6d… / 272f43b8… before TC-287, # 70c71aa0… / 8e602959… with the sidecar, 417719648a0c… / d6af7a70… before TC-3554, # 5419a6fb… before TC-1491, d703d69b… before TC-2917, 298ea356… before TC-2346, # 192dfb7e… before TC-1777), its single node digest normalized to 64 zeros. - n0_template_hash = '4520ee72189db061788d2a3f09c742fdae5aa8709717a5d983c6ee77e91ca4d0' + n0_template_hash = '693f06e86e0ea576a435b891214e9aaf528204c66131d85f53b4a805f8c47a60' node_pin = re.compile(rb'(?m)^ image: ghcr\.io/tinycloudlabs/tinycloud-node@sha256:([0-9a-f]{64})$') def n0_template(raw): pins = list(node_pin.finditer(raw)) diff --git a/CHANGELOG.md b/CHANGELOG.md index 908cd147..dc1ee941 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ - Ops: added a reversible local-config HTTP ingress switch and operator runbook for a separately verified independent Cloudflare origin. Dry-run is the default; production routing and policy execution remain separate. Details: TC-1387. - Production compose: stored SQL databases up to 320 MiB load again; saves still stop at 64 MiB (`TINYCLOUD_STORAGE__SQL__MAX_ARTIFACT_READ_BYTES: "320 MiB"`). Config only, no migration. Details: TC-1491. - Production compose: a `cloudflared` Cloudflare Tunnel connector service (image pinned by digest, no published ports, metrics on loopback, no log driver, on its own `cf-edge` network shared only with `tinycloud`, credential from the optional sealed `CLOUDFLARE_TUNNEL_TOKEN`). Unset, the rest of the stack deploys unchanged and the connector has no credential and carries nothing. The N0 compose template hash becomes `91802e6c…` (raw `68f00873…`). Config only, no migration. Details: TC-4194. -- **Production compose:** the log shipper's `VECTOR_CONFIG_JSON` ships the node's one deletion-ledger line per start as the individual event `deletion_ledger_start` (`ledger_file` missing/empty/present, `bytes`, `operations`, `key_entries`, `committed`, `aborted`, `newest_deleted_at`; counts only, no ids or paths), so an OS move or deploy can compare the ledger before and after, and names the DuckDB cache cleanup warning `duckdb_cache_cleanup_failed`. The N0 compose template hash becomes `4520ee72…` (raw `fdcf54f2…`; `docs/releasing.md` has the full values). Details: TC-4177, TC-4190. +- **Production compose:** the log shipper's `VECTOR_CONFIG_JSON` ships the node's one deletion-ledger line per start as the individual event `deletion_ledger_start` (`ledger_file` missing/empty/present, `bytes`, `operations`, `key_entries`, `committed`, `aborted`, `newest_deleted_at`; counts only, no ids or paths), so an OS move or deploy can compare the ledger before and after, and names the DuckDB cache cleanup warning `duckdb_cache_cleanup_failed`. It also pre-registers four `event_code` values for the store-master and shadow-local diagnostics that arrive with TC-1491 P4.2a (`store_master_mode_unreadable_refused`, `store_master_backstop_rotation_failed`, `shadow_local_working_copy_missing`, `shadow_local_read_failed`), so those lines are named from the first deploy. The N0 compose template hash becomes `693f06e8…` (raw `ef81b59f…`; `docs/releasing.md` has the full values). Details: TC-4177, TC-4190. - DuckDB: a failed cache cleanup is a `warn` again (event `duckdb_cache_cleanup_failed`), shipped as a counted diagnostic. #647 had demoted it to `debug` because no event code existed. Details: TC-4190. - DuckDB: the node opens and ends every transaction itself; client requests that send transaction control (`BEGIN`, `START TRANSACTION`, `COMMIT`, `END`, `ROLLBACK`, savepoints) are refused at every tier, and the SDK's `transactional` batches are unchanged. `nextval` and `setval` count as writes, so a read-tier or `readOnly` request is refused them. Line comments are parsed more strictly. Details: TC-3430. - DuckDB: a request marked `readOnly` allows only queries and `EXPLAIN`, whatever its ability tier. Transaction control (`BEGIN`, `COMMIT`, `ROLLBACK`) counts as a write, so the read tier and `readOnly` requests are refused it. Details: TC-3035. diff --git a/docker-compose.dstack-postgres.yaml b/docker-compose.dstack-postgres.yaml index d8c778c4..71b19e4a 100644 --- a/docker-compose.dstack-postgres.yaml +++ b/docker-compose.dstack-postgres.yaml @@ -275,7 +275,7 @@ services: environment: TINYCLOUD_LOGSHIP_PROFILE: ${TINYCLOUD_LOGSHIP_PROFILE:-errors_slow} BETTERSTACK_SOURCE_TOKEN: ${BETTERSTACK_SOURCE_TOKEN:?seal the node source token before enabling log shipping} - VECTOR_CONFIG_JSON: "{\"data_dir\":\"/var/lib/vector\",\"sources\":{\"gelf_in\":{\"type\":\"socket\",\"mode\":\"udp\",\"address\":\"0.0.0.0:12201\",\"max_length\":262144,\"receive_buffer_bytes\":8388608,\"framing\":{\"method\":\"chunked_gelf\",\"chunked_gelf\":{\"decompression\":\"Auto\"}},\"decoding\":{\"codec\":\"bytes\"}}},\"transforms\":{\"gelf_envelope\":{\"type\":\"remap\",\"inputs\":[\"gelf_in\"],\"source\":\"packet = string(.message) ?? \\\"\\\"\\nif length(packet) > 262144 {\\n . = {\\\"reason\\\": \\\"oversized\\\"}\\n} else {\\n outer, err = parse_json(packet)\\n if err != null || !is_object(outer) || (outer.version != \\\"1.1\\\" && outer.version != \\\"1.0\\\") {\\n . = {\\\"reason\\\": \\\"malformed_envelope\\\"}\\n } else if exists(outer.partial_message) || exists(outer._partial_message) {\\n . = {\\\"reason\\\": \\\"partial\\\"}\\n } else {\\n label = get(outer, [\\\"_tc.logship\\\"]) ?? null\\n . = {\\\"_tc.logship\\\": label, \\\"message\\\": outer.short_message}\\n }\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"logship_gate\":{\"type\":\"remap\",\"inputs\":[\"gelf_envelope\"],\"source\":\"if exists(.reason) {\\n . = {\\\"reason\\\": .reason}\\n} else {\\nlabel = string(get(., [\\\"_tc.logship\\\"]) ?? null) ?? \\\"\\\"\\nraw = .message\\nreason = \\\"\\\"\\nif label == \\\"\\\" { reason = \\\"unlabelled\\\" }\\nelse if !includes([\\\"tinycloud-node\\\", \\\"tinycloud-ingress\\\"], label) { reason = \\\"unexpected_label\\\" }\\nelse if exists(.partial_message) { reason = \\\"partial\\\" }\\nelse if !is_string(raw) { reason = \\\"malformed_envelope\\\" }\\nelse if length(string!(raw)) > 65536 { reason = \\\"oversized\\\" }\\nif reason != \\\"\\\" {\\n . = {\\\"reason\\\": reason}\\n} else {\\n parsed, err = parse_json(string!(raw))\\n if err != null || !is_object(parsed) { . = {\\\"reason\\\": \\\"non_json\\\"} }\\n else if exists(parsed.partial_message) { . = {\\\"reason\\\": \\\"partial\\\"} }\\n else {\\n target = string(parsed.target) ?? \\\"\\\"\\n level = downcase(string(parsed.level) ?? \\\"\\\")\\n gate_fields = object(parsed.fields) ?? {}\\n gate_event = string(gate_fields.event) ?? \\\"\\\"\\n if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && target != \\\"tinycloud\\\" && !starts_with(target, \\\"tinycloud::\\\") && target != \\\"tinycloud_core\\\" && !starts_with(target, \\\"tinycloud_core::\\\") {\\n . = {\\\"reason\\\": \\\"unknown_target\\\"}\\n } else if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && !((target == \\\"tinycloud::request\\\" || target == \\\"tinycloud::disk_headroom\\\" || target == \\\"tinycloud_core::models::delegation_mode\\\" || (target == \\\"tinycloud\\\" && gate_event == \\\"deletion_ledger_start\\\")) && level == \\\"info\\\") {\\n . = {\\\"reason\\\": \\\"filtered_level\\\"}\\n } else { . = {\\\"label\\\": label, \\\"parsed\\\": parsed} }\\n }\\n}\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_route\":{\"type\":\"route\",\"inputs\":[\"logship_gate\"],\"route\":{\"candidate\":\"exists(.parsed)\",\"rejected\":\"exists(.reason)\"}},\"allowlist\":{\"type\":\"remap\",\"inputs\":[\"gate_route.candidate\"],\"source\":\"# Only this fresh object can leave the process boundary. No envelope, span,\\n# message, error, identity, URI or unknown key is copied into it.\\nj = .parsed\\nlabel = .label\\nout = {}\\nts = \\\"\\\"\\nif label == \\\"tinycloud-node\\\" {\\n target = string(j.target) ?? \\\"\\\"\\n level = downcase(string!(j.level))\\n f = object(j.fields) ?? {}\\n msg = string(f.message) ?? \\\"\\\"\\n ts = string!(j.timestamp)\\n # Literal Rocket template aliases only; never split an arbitrary URI.\\n aliases = {\\\"/attestation?\\\":\\\"/attestation\\\",\\\"/.well-known/encryption/network/?\\\":\\\"/.well-known/encryption/network/\\\",\\\"/hooks/events?\\\":\\\"/hooks/events\\\",\\\"/hooks/webhooks?\\\":\\\"/hooks/webhooks\\\",\\\"/public//kv?\\\":\\\"/public//kv\\\"}\\n # TC-1840: the node's one 5xx diagnostic line per database failure ships as an individual event.\\n # The input must carry exactly the declared keys (the message plus these seven, and db_hash only\\n # when it is a valid pseudonym) with exactly the declared types and enum values. Anything else\\n # leaves db_event null and the line falls back to the unclassified count below; no value of it\\n # is ever copied unless it passed, and the shipped object is built from literals and the\\n # validated values only.\\n db_event = null\\n if target == \\\"tinycloud::request\\\" && level == \\\"warn\\\" && msg == \\\"database failure answered with a 5xx\\\" {\\n db_status = f.status\\n db_elapsed = f.elapsed_ms\\n db_code = string(f.code) ?? \\\"\\\"\\n db_service = string(f.service) ?? \\\"\\\"\\n db_kind = string(f.failure_kind) ?? \\\"\\\"\\n db_route = string(f.route) ?? \\\"\\\"\\n db_canonical_route = get(aliases, [db_route]) ?? null\\n if is_string(db_canonical_route) { db_route = db_canonical_route }\\n db_ok = is_integer(db_status) && is_integer(db_elapsed) && is_boolean(f.write_may_have_applied)\\n if db_ok {\\n db_status = int!(db_status)\\n db_elapsed = int!(db_elapsed)\\n db_ok = db_status >= 500 && db_status <= 599 && db_elapsed >= 0 && db_elapsed <= 9007199254740991 && includes([\\\"unavailable_retryable\\\",\\\"outcome_unknown\\\",\\\"internal\\\",\\\"sql_busy\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\"], db_code) && includes([\\\"sql\\\",\\\"duckdb\\\",\\\"kv\\\",\\\"other\\\"], db_service) && includes([\\\"pool_timeout\\\",\\\"pool_closed\\\",\\\"io\\\",\\\"statement_timeout\\\",\\\"serialization\\\",\\\"connection_lost\\\",\\\"artifact_changed\\\",\\\"lock_wait\\\",\\\"hydration\\\",\\\"artifact_transfer\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\",\\\"other\\\"], db_kind) && includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], db_route)\\n }\\n db_hash = string(f.db_hash) ?? \\\"\\\"\\n has_db_hash = exists(f.db_hash)\\n if db_ok {\\n if has_db_hash { db_ok = match(db_hash, r'^[0-9a-f]{64}$') && length(f) == 9 } else { db_ok = length(f) == 8 }\\n }\\n if db_ok {\\n db_event = {\\\"event\\\": \\\"node_warning\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"warn\\\", \\\"event_code\\\": \\\"db_failure_5xx\\\", \\\"status\\\": db_status, \\\"code\\\": db_code, \\\"service\\\": db_service, \\\"route\\\": db_route, \\\"elapsed_ms\\\": db_elapsed, \\\"failure_kind\\\": db_kind, \\\"write_may_have_applied\\\": bool!(f.write_may_have_applied)}\\n if has_db_hash { db_event.db_hash = db_hash }\\n }\\n }\\n # TC-2917: the node's periodic disk headroom line (one per local store) ships as an individual\\n # info event. Exactly the message plus `store` (a declared store) and `free_bytes` (a bounded\\n # integer in whole 64 MiB steps, as the node rounds it); anything else leaves headroom null, and\\n # the info line is then dropped below.\\n headroom = null\\n if target == \\\"tinycloud::disk_headroom\\\" && level == \\\"info\\\" && msg == \\\"storage headroom\\\" && length(f) == 3 {\\n h_store = string(f.store) ?? \\\"\\\"\\n h_free = f.free_bytes\\n if includes([\\\"sql\\\",\\\"duckdb\\\"], h_store) && is_integer(h_free) {\\n h_free = int!(h_free)\\n if h_free >= 0 && h_free <= 9007199254740991 && mod(h_free, 67108864) == 0 {\\n headroom = {\\\"event\\\": \\\"node_storage_headroom\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"store\\\": h_store, \\\"free_bytes\\\": h_free}\\n }\\n }\\n }\\n # TC-3973: ship the boot summary with exactly the seven bounded counters.\\n backfill = null\\n if target == \\\"tinycloud_core::models::delegation_mode\\\" && level == \\\"info\\\" && length(f) == 8 {\\n backfill_code = get({\\\"delegation mode boot reindex complete\\\":\\\"delegation_mode_boot_reindex_complete\\\",\\\"delegation mode boot reindex incomplete; skipped rows remain unmarked and derive on read\\\":\\\"delegation_mode_boot_reindex_incomplete\\\",\\\"delegation mode boot reindex incomplete (lock timeout); remaining rows derive on read\\\":\\\"delegation_mode_boot_reindex_lock_timeout\\\"}, [msg]) ?? null\\n if is_string(backfill_code) {\\n counters = {}\\n for_each([\\\"scanned\\\", \\\"reindexed_terminal\\\", \\\"marked_attenuable\\\", \\\"marked_invalid\\\", \\\"skipped_locked_pages\\\", \\\"skipped_decrypt_failed\\\", \\\"elapsed_ms\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n counters = set!(counters, [field], value)\\n }\\n }\\n if length(counters) == 7 {\\n backfill = merge(counters, {\\\"event\\\": \\\"delegation_mode_boot_reindex\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"event_code\\\": backfill_code})\\n }\\n }\\n }\\n # TC-4177: the deletion ledger's one line per start (target `tinycloud`, info) ships as an individual event. Either the\\n # message plus exactly `event`, `ledger_file` (a declared state), five bounded integer counts and `newest_deleted_at`\\n # (`none` or an RFC 3339 instant: digits, `T`, `:`, `.`, `Z`, `+`, `-` only), or the failure message plus exactly\\n # `event` and an `error_kind` from the ledger's fixed kinds. The message is never copied. Anything else leaves\\n # ledger_start null and the info line is dropped below.\\n ledger_start = null\\n if target == \\\"tinycloud\\\" && level == \\\"info\\\" && (string(f.event) ?? \\\"\\\") == \\\"deletion_ledger_start\\\" {\\n if msg == \\\"deletion ledger at start\\\" && length(f) == 9 {\\n ls_file = string(f.ledger_file) ?? \\\"\\\"\\n ls_newest = string(f.newest_deleted_at) ?? \\\"\\\"\\n if includes([\\\"missing\\\",\\\"empty\\\",\\\"present\\\"], ls_file) && match(ls_newest, r'^(none|\\\\d{4}-\\\\d{2}-\\\\d{2}[Tt]\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d{1,9})?([Zz]|[+-]\\\\d{2}:\\\\d{2}))$') {\\n ls_counts = {}\\n for_each([\\\"bytes\\\",\\\"operations\\\",\\\"key_entries\\\",\\\"committed\\\",\\\"aborted\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n ls_counts = set!(ls_counts, [field], value)\\n }\\n }\\n if length(ls_counts) == 5 {\\n ledger_start = merge(ls_counts, {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"ledger_file\\\": ls_file, \\\"newest_deleted_at\\\": ls_newest})\\n }\\n }\\n } else if msg == \\\"deletion ledger counts unavailable at start\\\" && length(f) == 3 {\\n ls_kind = string(f.error_kind) ?? \\\"\\\"\\n if includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], ls_kind) {\\n ledger_start = {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"error_kind\\\": ls_kind}\\n }\\n }\\n }\\n # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired\\n # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error\\n # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one\\n # of the ledger's fixed kinds. The message is never copied. Anything else leaves ledger null and the line falls back\\n # to the unclassified count below.\\n ledger = null\\n l_event = string(f.event) ?? \\\"\\\"\\n if level == \\\"error\\\" && includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], l_event) && exists(f.message) && length(f) == 3 {\\n l_target = get({\\\"deletion_ledger_open_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_replay_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_unrepaired\\\":\\\"tinycloud_core::encryption_network::deletion_ledger\\\"}, [l_event]) ?? \\\"\\\"\\n l_kind = string(f.error_kind) ?? \\\"\\\"\\n if target == l_target && includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], l_kind) {\\n ledger = {\\\"event\\\": l_event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"error\\\", \\\"error_kind\\\": l_kind}\\n }\\n }\\n if target == \\\"tinycloud::request\\\" && level == \\\"info\\\" && msg == \\\"request\\\" {\\n method = string!(f.method)\\n if includes([\\\"TRACE\\\", \\\"CONNECT\\\"], method) { method = \\\"\\\" }\\n route = string!(f.route)\\n canonical_route = get(aliases, [route]) ?? null\\n if is_string(canonical_route) { route = canonical_route }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = f.status\\n latency = f.latency_us\\n if !is_integer(status) || !is_integer(latency) { abort }\\n status = int!(status)\\n latency = int!(latency)\\n if status < 100 || status > 599 || latency < 0 || latency > 9007199254740991 { abort }\\n out = {\\\"event\\\": \\\"node_request\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"latency_us\\\": latency}\\n # N2 correlation fields: copied only when they have exactly the node's emitted shape; anything else is dropped\\n # (the event still ships). The pseudonyms are keyed HMAC-SHA256 digests, never raw identifiers.\\n rid = string(f.request_id) ?? \\\"\\\"\\n if match(rid, r'^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') { out.request_id = rid }\\n replaced = f.request_id_replaced\\n if is_boolean(replaced) { out.request_id_replaced = replaced }\\n account = string(f.account_hash) ?? \\\"\\\"\\n if match(account, r'^[0-9a-f]{64}$') { out.account_hash = account }\\n space = string(f.space_hash) ?? \\\"\\\"\\n if match(space, r'^[0-9a-f]{64}$') { out.space_hash = space }\\n # TC-3834: the 5xx origin, on status 500 and above only, and only when it is exactly one of the declared codes;\\n # anything else is dropped (the event still ships). A closed vocabulary, never error text.\\n if status >= 500 {\\n error_code = string(f.error_code) ?? \\\"\\\"\\n if includes([\\\"db_error\\\",\\\"db_timeout\\\",\\\"db_busy\\\",\\\"req_timeout\\\",\\\"read_audit\\\",\\\"storage_io\\\",\\\"caveat_db\\\",\\\"read_tx_error\\\",\\\"key_ledger\\\",\\\"lifecycle\\\",\\\"registry_down\\\",\\\"cutover_fence\\\",\\\"kv_candidate\\\",\\\"engine_error\\\",\\\"encryption\\\",\\\"size_limit\\\",\\\"disk_headroom\\\",\\\"internal\\\"], error_code) { out.error_code = error_code }\\n }\\n # TC-3739: per-request DB accounting, on status below 400 only (4xx/5xx are the capped classes; DB-caused 5xx\\n # already carry elapsed_ms on db_failure_5xx). Copied only as plain numbers inside the canonical bounds; anything\\n # else is dropped (the event still ships). They are driver wall times and an attempt count, never identifiers.\\n if status < 400 {\\n pool_wait = f.pool_wait_ms\\n if is_float(pool_wait) || is_integer(pool_wait) {\\n pool_wait = to_float!(pool_wait)\\n if pool_wait >= 0.0 && pool_wait <= 86400000.0 { out.pool_wait_ms = pool_wait }\\n }\\n query_time = f.query_time_ms\\n if is_float(query_time) || is_integer(query_time) {\\n query_time = to_float!(query_time)\\n if query_time >= 0.0 && query_time <= 86400000.0 { out.query_time_ms = query_time }\\n }\\n query_count = f.query_count\\n if is_integer(query_count) {\\n query_count = int!(query_count)\\n if query_count >= 0 && query_count <= 9007199254740991 { out.query_count = query_count }\\n }\\n }\\n } else if is_object(db_event) {\\n out = db_event\\n } else if is_object(headroom) {\\n out = headroom\\n } else if is_object(backfill) {\\n out = backfill\\n } else if is_object(ledger_start) {\\n out = ledger_start\\n } else if is_object(ledger) {\\n out = ledger\\n } else {\\n if !includes([\\\"warn\\\", \\\"error\\\"], level) { abort }\\n code = \\\"unclassified\\\"\\n if target == \\\"tinycloud\\\" || starts_with(target, \\\"tinycloud::\\\") || target == \\\"tinycloud_core\\\" || starts_with(target, \\\"tinycloud_core::\\\") {\\n codes = {\\\"delegation mode boot backfill failed; unmarked rows derive on read\\\":\\\"delegation_mode_boot_backfill_failed\\\",\\\"delegation mode boot reindex skipped rows that failed decryption; leaving unmarked for read-time fail-closed handling\\\":\\\"delegation_mode_boot_reindex_decrypt_failed\\\",\\\"invocation replay insert failed\\\":\\\"invocation_replay_insert_failed\\\",\\\"invocation replay cleanup failed\\\":\\\"invocation_replay_cleanup_failed\\\",\\\"share-v2 local-tee feature active: deriving a deterministic, non-attested TEE identity from node key material\\\":\\\"share_local_tee_identity\\\",\\\"retention: delivered hook delivery prune failed\\\":\\\"retention_hook_delivery_prune_failed\\\",\\\"retention: dead-letter hook delivery prune failed\\\":\\\"retention_dead_letter_prune_failed\\\",\\\"retention: signed KV ticket prune failed\\\":\\\"retention_signed_ticket_prune_failed\\\",\\\"failed to load tunnel state; tunnel not started\\\":\\\"tunnel_state_load_failed\\\",\\\"invalid loopback API address; tunnel not started\\\":\\\"tunnel_address_invalid\\\",\\\"failed to load link state; LAN listener not started\\\":\\\"link_state_load_failed\\\",\\\"invalid link bind address; LAN listener not started\\\":\\\"link_bind_invalid\\\",\\\"invalid loopback API address; LAN listener not started\\\":\\\"link_address_invalid\\\",\\\"failed to bind link LAN listener; LAN listener not started\\\":\\\"link_bind_failed\\\",\\\"failed to build TLS config; LAN listener not started\\\":\\\"link_tls_config_failed\\\",\\\"link LAN listener exited with error\\\":\\\"link_listener_error\\\",\\\"failed to record link listener bind state\\\":\\\"link_listener_state_write_failed\\\",\\\"failed to record link listener bind failure\\\":\\\"link_bind_state_write_failed\\\",\\\"failed to load config for auto-renew\\\":\\\"link_auto_renew_config_failed\\\",\\\"link auto-renew failed\\\":\\\"link_auto_renew_failed\\\",\\\"failed to hot-reload renewed link cert\\\":\\\"link_cert_reload_failed\\\",\\\"link auto-renew succeeded but no state.json found; skipping cert hot-reload\\\":\\\"link_cert_state_missing\\\",\\\"failed to reload TLS material after link auto-renew\\\":\\\"link_listener_cert_reload_failed\\\",\\\"link disable: service delete failed; local state removed anyway\\\":\\\"link_disable_failed\\\",\\\"link connection error\\\":\\\"link_connection_error\\\",\\\"link listener accept error\\\":\\\"link_listener_accept_failed\\\",\\\"webhook delivery attempt failed\\\":\\\"webhook_delivery_failed\\\",\\\"webhook dispatcher loop failed\\\":\\\"webhook_dispatcher_failed\\\",\\\"addressed delegation authorization failed\\\":\\\"share_authorization_failed\\\",\\\"native share authorization denied\\\":\\\"share_native_authorization_denied\\\",\\\"native share KV put failed\\\":\\\"share_native_kv_put_failed\\\",\\\"share v2 readiness probe failed\\\":\\\"share_v2_readiness_failed\\\",\\\"share v2 is enabled but shareEmail.invitationPublicKey is unset\\\":\\\"share_invitation_key_missing\\\",\\\"configured share invitation key does not match the node's derived signing key\\\":\\\"share_invitation_key_mismatch\\\",\\\"share/v2 policy challenge denied\\\":\\\"share_policy_denied\\\",\\\"failed to read committed hook events\\\":\\\"hook_events_read_failed\\\",\\\"failed to load kv write hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"failed to load kv delete hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"missing committed kv hook row for invocation\\\":\\\"missing_committed_hook_row\\\",\\\"database write committed but webhook enqueue failed\\\":\\\"webhook_enqueue_failed\\\",\\\"tunnel: failed to prepare connection attempt\\\":\\\"tunnel_connection_prepare_failed\\\",\\\"tunnel: no frame within idle timeout; treating connection as dead\\\":\\\"tunnel_idle_timeout\\\",\\\"tunnel: read error\\\":\\\"tunnel_read_failed\\\",\\\"tunnel: dropping malformed frame\\\":\\\"tunnel_malformed_frame\\\",\\\"tunnel: relay sent an error frame\\\":\\\"tunnel_relay_error\\\",\\\"tunnel: failed to write frame\\\":\\\"tunnel_write_failed\\\",\\\"tunnel: failed to record runtime state\\\":\\\"tunnel_state_record_failed\\\",\\\"tunnel: failed to clear runtime state after disable\\\":\\\"tunnel_state_clear_failed\\\",\\\"tunnel authentication rejected\\\":\\\"tunnel_auth_rejected\\\",\\\"network DID resolution enabled: did:web/did:tz fetches use the unhardened ssi client (TC-1080)\\\":\\\"network_did_resolution_enabled\\\",\\\"SQL busy: lock wait\\\":\\\"sql_busy_lock_wait\\\",\\\"SQL busy: hydration\\\":\\\"sql_busy_hydration\\\",\\\"SQL busy: artifact transfer\\\":\\\"sql_busy_artifact_transfer\\\",\\\"Request deadline exceeded\\\":\\\"request_timeout\\\",\\\"Request completed after its deadline\\\":\\\"deadline_overrun\\\",\\\"Database hydration gave up loading its artifact\\\":\\\"sql_hydration_timeout\\\",\\\"Read audit wait expired\\\":\\\"read_audit_busy\\\",\\\"Read audit batch slow\\\":\\\"read_audit_batch_slow\\\",\\\"Read audit batch failed\\\":\\\"read_audit_batch_failed\\\",\\\"Read audit drain stalled\\\":\\\"read_audit_drain_stalled\\\",\\\"retrying operation after a lost database connection\\\":\\\"db_operation_retried\\\",\\\"not retrying operation: its first run took longer than the retry window to fail\\\":\\\"db_operation_retry_skipped_slow\\\",\\\"idx_current_kv_space_deleted_key_c is missing; the node keeps serving and KV list requests are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_current_kv_space_deleted_key_c)\\\":\\\"current_kv_c_index_missing\\\",\\\"idx_current_kv_space_deleted_key_c is invalid or still being built; the node keeps serving and KV list requests are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_invalid\\\",\\\"idx_current_kv_space_deleted_key_c exists with the wrong definition and is not used for KV lists; the node keeps serving and KV list requests are slower. Run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_wrong_shape\\\",\\\"idx_kv_write_space_value is missing; the node keeps serving and KV writes that attach a blob are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_kv_write_space_value)\\\":\\\"kv_write_value_index_missing\\\",\\\"idx_kv_write_space_value is invalid or still being built; the node keeps serving and KV writes that attach a blob are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_invalid\\\",\\\"idx_kv_write_space_value exists with the wrong definition and is not used for blob reference checks; the node keeps serving and KV writes that attach a blob are slower. Run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_wrong_shape\\\",\\\"request answered with a 5xx\\\":\\\"http_5xx\\\",\\\"chain guard wait exceeded the slow-wait threshold\\\":\\\"chain_guard_slow_wait\\\",\\\"kv head size probe failed; size omitted\\\":\\\"kv_head_size_probe_failed\\\",\\\"Database checkpoint save failed; refusing its writes until the back-off ends\\\":\\\"sql_checkpoint_save_backoff\\\",\\\"Database exceeds the artifact read limit; not loaded\\\":\\\"sql_database_too_large_to_load\\\",\\\"Database checkpoint exceeds the artifact write limit; not saved\\\":\\\"sql_checkpoint_too_large\\\",\\\"Database checkpoint shrank sharply against the artifact it replaces\\\":\\\"sql_checkpoint_shrank\\\",\\\"Database artifact storage unavailable\\\":\\\"sql_artifact_storage_unavailable\\\",\\\"Database artifact kept changing while it was read\\\":\\\"sql_artifact_changed_during_read\\\",\\\"Artifact part integrity check failed\\\":\\\"artifact_part_hash_mismatch\\\",\\\"Artifact part collection deferred\\\":\\\"artifact_part_collection_deferred\\\",\\\"Durable database artifact does not carry the expected file header; refusing to hydrate\\\":\\\"artifact_header_invalid\\\",\\\"No recorded artifact lineage for a live database; saving without a lineage assertion\\\":\\\"artifact_lineage_missing\\\",\\\"No recorded artifact lineage for a live database; discarding the actor\\\":\\\"artifact_lineage_missing_discarded\\\",\\\"Failed to open database\\\":\\\"database_open_failed\\\",\\\"Failed to promote database to file\\\":\\\"database_promote_failed\\\",\\\"Not enough free disk to promote a database; keeping it in memory\\\":\\\"database_promote_no_disk\\\",\\\"failed to copy view during table copy\\\":\\\"duckdb_view_copy_failed\\\",\\\"Database cache cleanup failed\\\":\\\"duckdb_cache_cleanup_failed\\\",\\\"sql ddl allowed without schema ability (ddl_requires_schema = log)\\\":\\\"sql_ddl_without_schema\\\",\\\"Local SQL commit failed\\\":\\\"sql_commit_failed\\\",\\\"Dead SQL actor detected, respawning\\\":\\\"sql_actor_respawned\\\",\\\"Dead SQL actor detected during export, removing\\\":\\\"sql_actor_dead_on_export\\\",\\\"sql_store shadow upload blocked for a database\\\":\\\"shadow_upload_blocked\\\",\\\"sql_store shadow could not read a manifest row\\\":\\\"shadow_manifest_read_failed\\\",\\\"sql_store shadow lag scan failed\\\":\\\"shadow_lag_scan_failed\\\",\\\"sql_store shadow drained behind PG\\\":\\\"shadow_drained_behind_pg\\\",\\\"database connection lost\\\":\\\"db_connection_lost\\\",\\\"retries suppressed after a database overload signal\\\":\\\"db_retries_suppressed\\\",\\\"not retrying operation: retries are suppressed after a database overload signal\\\":\\\"db_operation_retry_suppressed\\\",\\\"not retrying operation: the request deadline leaves no room\\\":\\\"db_operation_retry_no_deadline\\\",\\\"retry attempt stopped: the operation budget expired\\\":\\\"db_operation_retry_budget_spent\\\",\\\"Read audit batch timed out\\\":\\\"read_audit_batch_timeout\\\",\\\"failed to refund orphaned KV blob; periodic collector will retry\\\":\\\"kv_blob_refund_failed\\\",\\\"a deleting fence named a blob that a committed write references; it was closed without deleting the blob\\\":\\\"kv_blob_delete_skipped_referenced\\\",\\\"KV orphan collection failed\\\":\\\"kv_orphan_collection_failed\\\",\\\"delegate epoch path failed\\\":\\\"delegate_epoch_path_failed\\\",\\\"epoch insert failed\\\":\\\"epoch_insert_failed\\\",\\\"epoch head backfill stopped at its first error; writes stay correct and repair each space on its next write\\\":\\\"epoch_head_backfill_failed\\\",\\\"invocation referenced a space absent from the database\\\":\\\"invocation_space_missing\\\",\\\"deletion ledger is locked by another process: waiting for it\\\":\\\"deletion_ledger_lock_wait\\\",\\\"deletion ledger replayed at start\\\":\\\"deletion_ledger_replayed\\\",\\\"deletion ledger: committed line was not written\\\":\\\"deletion_ledger_commit_unwritten\\\",\\\"deletion ledger: could not tell whether a delete committed; the operation stays open\\\":\\\"deletion_ledger_commit_unknown\\\",\\\"deletion ledger: the settling line was not written\\\":\\\"deletion_ledger_settle_unwritten\\\",\\\"could not record losing network create ceremony as failed\\\":\\\"network_create_ceremony_mark_failed\\\",\\\"share scope validation failed\\\":\\\"share_scope_validation_failed\\\",\\\"delivery authorization refused\\\":\\\"delivery_authorization_refused\\\",\\\"delivery authorizations refused by the rate limit\\\":\\\"delivery_rate_limited\\\",\\\"deactivated webhook subscriptions; owners must re-register\\\":\\\"hook_subscriptions_deactivated\\\",\\\"webhook egress closed: internal endpoint refresh failed\\\":\\\"webhook_egress_refresh_failed\\\",\\\"webhook egress closed: internal endpoint lookup failed\\\":\\\"webhook_egress_lookup_failed\\\",\\\"webhook delivery mark refused: lease no longer held\\\":\\\"webhook_mark_lease_lost\\\",\\\"webhook delivery lease release failed\\\":\\\"webhook_lease_release_failed\\\",\\\"webhook delivery send skipped: lease no longer held\\\":\\\"webhook_send_lease_lost\\\",\\\"internal renewal scheduler pass failed\\\":\\\"renewal_scheduler_tick_failed\\\",\\\"renewals paused node-wide\\\":\\\"renewals_paused\\\",\\\"renewals resumed node-wide\\\":\\\"renewals_resumed\\\",\\\"the links API clock differs from the node clock\\\":\\\"links_read_clock_skew\\\",\\\"purge ledger reconciliation failed; space traffic stays refused\\\":\\\"space_purge_reconcile_failed\\\",\\\"space purge residue sweep failed\\\":\\\"space_purge_sweep_failed\\\",\\\"space purge phase failed; retrying later\\\":\\\"space_purge_phase_failed\\\",\\\"space purge attempt release failed\\\":\\\"space_purge_release_failed\\\",\\\"space purge claim failed\\\":\\\"space_purge_claim_failed\\\",\\\"owner erasure pass failed; retrying later\\\":\\\"owner_erasure_pass_failed\\\",\\\"skipped invalid space directories while measuring storage\\\":\\\"storage_invalid_space_dirs\\\",\\\"removed setting is set and ignored; delete it from the configuration\\\":\\\"removed_setting_ignored\\\",\\\"admin stats result exceeds its bound\\\":\\\"admin_stats_over_bound\\\",\\\"admin stats query failed\\\":\\\"admin_stats_query_failed\\\",\\\"TDX quote unavailable\\\":\\\"attestation_quote_unavailable\\\",\\\"dstack guest agent returned an error\\\":\\\"dstack_guest_agent_error\\\",\\\"tunnel: failed to build upstream HTTP client\\\":\\\"tunnel_upstream_client_failed\\\"}\\n known = get(codes, [msg]) ?? null\\n if is_string(known) { code = known }\\n if starts_with(msg, \\\"quota service returned \\\") { code = \\\"quota_fallback\\\" }\\nif starts_with(msg, \\\"Failed to get TDX quote: \\\") { code = \\\"attestation_quote_failed\\\" }\\nif starts_with(msg, \\\"created a new node identity at \\\") { code = \\\"node_identity_created\\\" }\\nif starts_with(msg, \\\"quota service returned an invalid body: \\\") { code = \\\"quota_invalid_body\\\" }\\nif starts_with(msg, \\\"dstack socket available but get_info failed: \\\") { code = \\\"dstack_get_info_failed\\\" }\\n # TC-3284: a line with no message is named by its constant `event` field, only when that event is listed.\\n if msg == \\\"\\\" && !exists(f.message) {\\n events = {\\\"did_resolution_refused\\\":\\\"did_resolution_refused\\\",\\\"renewal_scheduler_lease_failed\\\":\\\"renewal_scheduler_lease_failed\\\",\\\"session_retire_failed\\\":\\\"session_retire_failed\\\"}\\n named = get(events, [string(f.event) ?? \\\"\\\"]) ?? null\\n if is_string(named) { code = named }\\n }\\n }\\n if level == \\\"warn\\\" && target == \\\"rocket::config::config\\\" && msg == \\\"found value for deprecated config key `log`\\\" { code = \\\"rocket_deprecated_log_config\\\" }\\nif level == \\\"warn\\\" && target == \\\"rocket::launch\\\" && starts_with(msg, \\\"Rocket has launched from \\\") { code = \\\"rocket_launched\\\" }\\n event = if level == \\\"warn\\\" { \\\"node_warning\\\" } else { \\\"node_error\\\" }\\n out = {\\\"event\\\": event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": level, \\\"event_code\\\": code, \\\"event_count\\\": 1}\\n }\\n} else {\\n ts = string!(j.time)\\n method = string!(j.method)\\n route = string!(j.route)\\n if route == \\\"\\\" { route = \\\"\\\" }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = j.status\\n request_time = j.request_time\\n if !is_integer(status) || !(is_integer(request_time) || is_float(request_time)) { abort }\\n status = int!(status)\\n request_time = to_float!(request_time)\\n if status < 100 || status > 599 || request_time < 0 || request_time > 86400 { abort }\\n out = {\\\"event\\\": \\\"ingress_request\\\", \\\"svc\\\": \\\"ingress\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"request_time_seconds\\\": request_time}\\n}\\nif length(ts) > 64 { abort }\\nparsed_ts = parse_timestamp!(ts, format: \\\"%+\\\")\\nout.ts = format_timestamp!(parsed_ts, format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\")\\n. = out\\n\",\"drop_on_error\":true,\"drop_on_abort\":true,\"reroute_dropped\":true},\"gate_counts\":{\"type\":\"remap\",\"inputs\":[\"gate_route.rejected\",\"gate_route._unmatched\",\"allowlist.dropped\",\"event_route._unmatched\"],\"source\":\"reason = .reason\\nif !includes([\\\"malformed_envelope\\\",\\\"unexpected_label\\\",\\\"unlabelled\\\",\\\"non_json\\\",\\\"oversized\\\",\\\"partial\\\",\\\"invalid_fields\\\",\\\"unknown_target\\\",\\\"filtered_level\\\"], reason) { reason = \\\"invalid_fields\\\" }\\n. = {\\\"reason\\\": reason, \\\"count\\\": 1}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_reduce\":{\"type\":\"reduce\",\"inputs\":[\"gate_counts\"],\"group_by\":[\"reason\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"count\":\"sum\"}},\"gate_output\":{\"type\":\"remap\",\"inputs\":[\"gate_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": \\\"warn\\\", \\\"event\\\": \\\"logship_gate_summary_total\\\", \\\"svc\\\": \\\"logship\\\", \\\"reason\\\": .reason, \\\"count\\\": .count}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"request_profile\":{\"type\":\"filter\",\"inputs\":[\"allowlist\"],\"condition\":\"\\\"$${TINYCLOUD_LOGSHIP_PROFILE}\\\" == \\\"all_requests\\\" || includes([\\\"node_warning\\\",\\\"node_error\\\",\\\"node_storage_headroom\\\",\\\"delegation_mode_boot_reindex\\\",\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\",\\\"deletion_ledger_start\\\"], .event) || (int(.status) ?? 0) >= 400 || (.event == \\\"node_request\\\" && (int(.latency_us) ?? 0) > 1000000) || (.event == \\\"ingress_request\\\" && (to_float(.request_time_seconds) ?? 0.0) > 1.000000)\"},\"event_route\":{\"type\":\"route\",\"inputs\":[\"request_profile\"],\"route\":{\"request\":\"(.event == \\\"node_request\\\" || .event == \\\"ingress_request\\\") && !(((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)) && !((int(.status) ?? 0) >= 500)\",\"node_request_5xx\":\".event == \\\"node_request\\\" && (int(.status) ?? 0) >= 500\",\"ingress_request_5xx\":\".event == \\\"ingress_request\\\" && (int(.status) ?? 0) >= 500\",\"node_request_4xx\":\".event == \\\"node_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"ingress_request_4xx\":\".event == \\\"ingress_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"db_failure_5xx\":\".event == \\\"node_warning\\\" && .event_code == \\\"db_failure_5xx\\\"\",\"storage_headroom\":\".event == \\\"node_storage_headroom\\\"\",\"delegation_mode_boot_reindex\":\".event == \\\"delegation_mode_boot_reindex\\\"\",\"deletion_ledger\":\"includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event)\",\"deletion_ledger_start\":\".event == \\\"deletion_ledger_start\\\"\",\"diagnostic\":\"(.event == \\\"node_warning\\\" && .event_code != \\\"db_failure_5xx\\\") || .event == \\\"node_error\\\"\"}},\"cap_db_failure_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.db_failure_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"db_failure_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"diagnostic_reduce\":{\"type\":\"reduce\",\"inputs\":[\"event_route.diagnostic\"],\"group_by\":[\"event\",\"event_code\",\"level\",\"svc\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"event_count\":\"sum\",\"ts\":\"discard\"}},\"diagnostic_output\":{\"type\":\"remap\",\"inputs\":[\"diagnostic_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": .level, \\\"event\\\": .event, \\\"svc\\\": \\\"api\\\", \\\"event_code\\\": .event_code, \\\"event_count\\\": .event_count}\",\"drop_on_error\":true,\"drop_on_abort\":true}},\"sinks\":{\"betterstack\":{\"type\":\"http\",\"inputs\":[\"event_route.request\",\"event_route.storage_headroom\",\"event_route.delegation_mode_boot_reindex\",\"event_route.deletion_ledger\",\"event_route.deletion_ledger_start\",\"cap_db_failure_5xx\",\"cap_node_request_5xx\",\"cap_ingress_request_5xx\",\"cap_node_request_4xx\",\"cap_ingress_request_4xx\",\"diagnostic_output\",\"gate_output\"],\"method\":\"post\",\"uri\":\"https://s2795437.us-west-2a.betterstackdata.com/\",\"encoding\":{\"codec\":\"json\"},\"framing\":{\"method\":\"newline_delimited\"},\"compression\":\"gzip\",\"auth\":{\"strategy\":\"bearer\",\"token\":\"SECRET[bs.bs_token]\"},\"batch\":{\"max_bytes\":262144,\"timeout_secs\":1},\"buffer\":{\"type\":\"memory\",\"max_events\":1000,\"when_full\":\"block\"},\"request\":{\"timeout_secs\":10,\"retry_max_duration_secs\":300},\"healthcheck\":{\"enabled\":false}}},\"secret\":{\"bs\":{\"type\":\"directory\",\"path\":\"/var/lib/vector/secrets\",\"remove_trailing_whitespace\":true}}}" + VECTOR_CONFIG_JSON: "{\"data_dir\":\"/var/lib/vector\",\"sources\":{\"gelf_in\":{\"type\":\"socket\",\"mode\":\"udp\",\"address\":\"0.0.0.0:12201\",\"max_length\":262144,\"receive_buffer_bytes\":8388608,\"framing\":{\"method\":\"chunked_gelf\",\"chunked_gelf\":{\"decompression\":\"Auto\"}},\"decoding\":{\"codec\":\"bytes\"}}},\"transforms\":{\"gelf_envelope\":{\"type\":\"remap\",\"inputs\":[\"gelf_in\"],\"source\":\"packet = string(.message) ?? \\\"\\\"\\nif length(packet) > 262144 {\\n . = {\\\"reason\\\": \\\"oversized\\\"}\\n} else {\\n outer, err = parse_json(packet)\\n if err != null || !is_object(outer) || (outer.version != \\\"1.1\\\" && outer.version != \\\"1.0\\\") {\\n . = {\\\"reason\\\": \\\"malformed_envelope\\\"}\\n } else if exists(outer.partial_message) || exists(outer._partial_message) {\\n . = {\\\"reason\\\": \\\"partial\\\"}\\n } else {\\n label = get(outer, [\\\"_tc.logship\\\"]) ?? null\\n . = {\\\"_tc.logship\\\": label, \\\"message\\\": outer.short_message}\\n }\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"logship_gate\":{\"type\":\"remap\",\"inputs\":[\"gelf_envelope\"],\"source\":\"if exists(.reason) {\\n . = {\\\"reason\\\": .reason}\\n} else {\\nlabel = string(get(., [\\\"_tc.logship\\\"]) ?? null) ?? \\\"\\\"\\nraw = .message\\nreason = \\\"\\\"\\nif label == \\\"\\\" { reason = \\\"unlabelled\\\" }\\nelse if !includes([\\\"tinycloud-node\\\", \\\"tinycloud-ingress\\\"], label) { reason = \\\"unexpected_label\\\" }\\nelse if exists(.partial_message) { reason = \\\"partial\\\" }\\nelse if !is_string(raw) { reason = \\\"malformed_envelope\\\" }\\nelse if length(string!(raw)) > 65536 { reason = \\\"oversized\\\" }\\nif reason != \\\"\\\" {\\n . = {\\\"reason\\\": reason}\\n} else {\\n parsed, err = parse_json(string!(raw))\\n if err != null || !is_object(parsed) { . = {\\\"reason\\\": \\\"non_json\\\"} }\\n else if exists(parsed.partial_message) { . = {\\\"reason\\\": \\\"partial\\\"} }\\n else {\\n target = string(parsed.target) ?? \\\"\\\"\\n level = downcase(string(parsed.level) ?? \\\"\\\")\\n gate_fields = object(parsed.fields) ?? {}\\n gate_event = string(gate_fields.event) ?? \\\"\\\"\\n if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && target != \\\"tinycloud\\\" && !starts_with(target, \\\"tinycloud::\\\") && target != \\\"tinycloud_core\\\" && !starts_with(target, \\\"tinycloud_core::\\\") {\\n . = {\\\"reason\\\": \\\"unknown_target\\\"}\\n } else if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && !((target == \\\"tinycloud::request\\\" || target == \\\"tinycloud::disk_headroom\\\" || target == \\\"tinycloud_core::models::delegation_mode\\\" || (target == \\\"tinycloud\\\" && gate_event == \\\"deletion_ledger_start\\\")) && level == \\\"info\\\") {\\n . = {\\\"reason\\\": \\\"filtered_level\\\"}\\n } else { . = {\\\"label\\\": label, \\\"parsed\\\": parsed} }\\n }\\n}\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_route\":{\"type\":\"route\",\"inputs\":[\"logship_gate\"],\"route\":{\"candidate\":\"exists(.parsed)\",\"rejected\":\"exists(.reason)\"}},\"allowlist\":{\"type\":\"remap\",\"inputs\":[\"gate_route.candidate\"],\"source\":\"# Only this fresh object can leave the process boundary. No envelope, span,\\n# message, error, identity, URI or unknown key is copied into it.\\nj = .parsed\\nlabel = .label\\nout = {}\\nts = \\\"\\\"\\nif label == \\\"tinycloud-node\\\" {\\n target = string(j.target) ?? \\\"\\\"\\n level = downcase(string!(j.level))\\n f = object(j.fields) ?? {}\\n msg = string(f.message) ?? \\\"\\\"\\n ts = string!(j.timestamp)\\n # Literal Rocket template aliases only; never split an arbitrary URI.\\n aliases = {\\\"/attestation?\\\":\\\"/attestation\\\",\\\"/.well-known/encryption/network/?\\\":\\\"/.well-known/encryption/network/\\\",\\\"/hooks/events?\\\":\\\"/hooks/events\\\",\\\"/hooks/webhooks?\\\":\\\"/hooks/webhooks\\\",\\\"/public//kv?\\\":\\\"/public//kv\\\"}\\n # TC-1840: the node's one 5xx diagnostic line per database failure ships as an individual event.\\n # The input must carry exactly the declared keys (the message plus these seven, and db_hash only\\n # when it is a valid pseudonym) with exactly the declared types and enum values. Anything else\\n # leaves db_event null and the line falls back to the unclassified count below; no value of it\\n # is ever copied unless it passed, and the shipped object is built from literals and the\\n # validated values only.\\n db_event = null\\n if target == \\\"tinycloud::request\\\" && level == \\\"warn\\\" && msg == \\\"database failure answered with a 5xx\\\" {\\n db_status = f.status\\n db_elapsed = f.elapsed_ms\\n db_code = string(f.code) ?? \\\"\\\"\\n db_service = string(f.service) ?? \\\"\\\"\\n db_kind = string(f.failure_kind) ?? \\\"\\\"\\n db_route = string(f.route) ?? \\\"\\\"\\n db_canonical_route = get(aliases, [db_route]) ?? null\\n if is_string(db_canonical_route) { db_route = db_canonical_route }\\n db_ok = is_integer(db_status) && is_integer(db_elapsed) && is_boolean(f.write_may_have_applied)\\n if db_ok {\\n db_status = int!(db_status)\\n db_elapsed = int!(db_elapsed)\\n db_ok = db_status >= 500 && db_status <= 599 && db_elapsed >= 0 && db_elapsed <= 9007199254740991 && includes([\\\"unavailable_retryable\\\",\\\"outcome_unknown\\\",\\\"internal\\\",\\\"sql_busy\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\"], db_code) && includes([\\\"sql\\\",\\\"duckdb\\\",\\\"kv\\\",\\\"other\\\"], db_service) && includes([\\\"pool_timeout\\\",\\\"pool_closed\\\",\\\"io\\\",\\\"statement_timeout\\\",\\\"serialization\\\",\\\"connection_lost\\\",\\\"artifact_changed\\\",\\\"lock_wait\\\",\\\"hydration\\\",\\\"artifact_transfer\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\",\\\"other\\\"], db_kind) && includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], db_route)\\n }\\n db_hash = string(f.db_hash) ?? \\\"\\\"\\n has_db_hash = exists(f.db_hash)\\n if db_ok {\\n if has_db_hash { db_ok = match(db_hash, r'^[0-9a-f]{64}$') && length(f) == 9 } else { db_ok = length(f) == 8 }\\n }\\n if db_ok {\\n db_event = {\\\"event\\\": \\\"node_warning\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"warn\\\", \\\"event_code\\\": \\\"db_failure_5xx\\\", \\\"status\\\": db_status, \\\"code\\\": db_code, \\\"service\\\": db_service, \\\"route\\\": db_route, \\\"elapsed_ms\\\": db_elapsed, \\\"failure_kind\\\": db_kind, \\\"write_may_have_applied\\\": bool!(f.write_may_have_applied)}\\n if has_db_hash { db_event.db_hash = db_hash }\\n }\\n }\\n # TC-2917: the node's periodic disk headroom line (one per local store) ships as an individual\\n # info event. Exactly the message plus `store` (a declared store) and `free_bytes` (a bounded\\n # integer in whole 64 MiB steps, as the node rounds it); anything else leaves headroom null, and\\n # the info line is then dropped below.\\n headroom = null\\n if target == \\\"tinycloud::disk_headroom\\\" && level == \\\"info\\\" && msg == \\\"storage headroom\\\" && length(f) == 3 {\\n h_store = string(f.store) ?? \\\"\\\"\\n h_free = f.free_bytes\\n if includes([\\\"sql\\\",\\\"duckdb\\\"], h_store) && is_integer(h_free) {\\n h_free = int!(h_free)\\n if h_free >= 0 && h_free <= 9007199254740991 && mod(h_free, 67108864) == 0 {\\n headroom = {\\\"event\\\": \\\"node_storage_headroom\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"store\\\": h_store, \\\"free_bytes\\\": h_free}\\n }\\n }\\n }\\n # TC-3973: ship the boot summary with exactly the seven bounded counters.\\n backfill = null\\n if target == \\\"tinycloud_core::models::delegation_mode\\\" && level == \\\"info\\\" && length(f) == 8 {\\n backfill_code = get({\\\"delegation mode boot reindex complete\\\":\\\"delegation_mode_boot_reindex_complete\\\",\\\"delegation mode boot reindex incomplete; skipped rows remain unmarked and derive on read\\\":\\\"delegation_mode_boot_reindex_incomplete\\\",\\\"delegation mode boot reindex incomplete (lock timeout); remaining rows derive on read\\\":\\\"delegation_mode_boot_reindex_lock_timeout\\\"}, [msg]) ?? null\\n if is_string(backfill_code) {\\n counters = {}\\n for_each([\\\"scanned\\\", \\\"reindexed_terminal\\\", \\\"marked_attenuable\\\", \\\"marked_invalid\\\", \\\"skipped_locked_pages\\\", \\\"skipped_decrypt_failed\\\", \\\"elapsed_ms\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n counters = set!(counters, [field], value)\\n }\\n }\\n if length(counters) == 7 {\\n backfill = merge(counters, {\\\"event\\\": \\\"delegation_mode_boot_reindex\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"event_code\\\": backfill_code})\\n }\\n }\\n }\\n # TC-4177: the deletion ledger's one line per start (target `tinycloud`, info) ships as an individual event. Either the\\n # message plus exactly `event`, `ledger_file` (a declared state), five bounded integer counts and `newest_deleted_at`\\n # (`none` or an RFC 3339 instant: digits, `T`, `:`, `.`, `Z`, `+`, `-` only), or the failure message plus exactly\\n # `event` and an `error_kind` from the ledger's fixed kinds. The message is never copied. Anything else leaves\\n # ledger_start null and the info line is dropped below.\\n ledger_start = null\\n if target == \\\"tinycloud\\\" && level == \\\"info\\\" && (string(f.event) ?? \\\"\\\") == \\\"deletion_ledger_start\\\" {\\n if msg == \\\"deletion ledger at start\\\" && length(f) == 9 {\\n ls_file = string(f.ledger_file) ?? \\\"\\\"\\n ls_newest = string(f.newest_deleted_at) ?? \\\"\\\"\\n if includes([\\\"missing\\\",\\\"empty\\\",\\\"present\\\"], ls_file) && match(ls_newest, r'^(none|\\\\d{4}-\\\\d{2}-\\\\d{2}[Tt]\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d{1,9})?([Zz]|[+-]\\\\d{2}:\\\\d{2}))$') {\\n ls_counts = {}\\n for_each([\\\"bytes\\\",\\\"operations\\\",\\\"key_entries\\\",\\\"committed\\\",\\\"aborted\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n ls_counts = set!(ls_counts, [field], value)\\n }\\n }\\n if length(ls_counts) == 5 {\\n ledger_start = merge(ls_counts, {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"ledger_file\\\": ls_file, \\\"newest_deleted_at\\\": ls_newest})\\n }\\n }\\n } else if msg == \\\"deletion ledger counts unavailable at start\\\" && length(f) == 3 {\\n ls_kind = string(f.error_kind) ?? \\\"\\\"\\n if includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], ls_kind) {\\n ledger_start = {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"error_kind\\\": ls_kind}\\n }\\n }\\n }\\n # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired\\n # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error\\n # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one\\n # of the ledger's fixed kinds. The message is never copied. Anything else leaves ledger null and the line falls back\\n # to the unclassified count below.\\n ledger = null\\n l_event = string(f.event) ?? \\\"\\\"\\n if level == \\\"error\\\" && includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], l_event) && exists(f.message) && length(f) == 3 {\\n l_target = get({\\\"deletion_ledger_open_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_replay_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_unrepaired\\\":\\\"tinycloud_core::encryption_network::deletion_ledger\\\"}, [l_event]) ?? \\\"\\\"\\n l_kind = string(f.error_kind) ?? \\\"\\\"\\n if target == l_target && includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], l_kind) {\\n ledger = {\\\"event\\\": l_event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"error\\\", \\\"error_kind\\\": l_kind}\\n }\\n }\\n if target == \\\"tinycloud::request\\\" && level == \\\"info\\\" && msg == \\\"request\\\" {\\n method = string!(f.method)\\n if includes([\\\"TRACE\\\", \\\"CONNECT\\\"], method) { method = \\\"\\\" }\\n route = string!(f.route)\\n canonical_route = get(aliases, [route]) ?? null\\n if is_string(canonical_route) { route = canonical_route }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = f.status\\n latency = f.latency_us\\n if !is_integer(status) || !is_integer(latency) { abort }\\n status = int!(status)\\n latency = int!(latency)\\n if status < 100 || status > 599 || latency < 0 || latency > 9007199254740991 { abort }\\n out = {\\\"event\\\": \\\"node_request\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"latency_us\\\": latency}\\n # N2 correlation fields: copied only when they have exactly the node's emitted shape; anything else is dropped\\n # (the event still ships). The pseudonyms are keyed HMAC-SHA256 digests, never raw identifiers.\\n rid = string(f.request_id) ?? \\\"\\\"\\n if match(rid, r'^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') { out.request_id = rid }\\n replaced = f.request_id_replaced\\n if is_boolean(replaced) { out.request_id_replaced = replaced }\\n account = string(f.account_hash) ?? \\\"\\\"\\n if match(account, r'^[0-9a-f]{64}$') { out.account_hash = account }\\n space = string(f.space_hash) ?? \\\"\\\"\\n if match(space, r'^[0-9a-f]{64}$') { out.space_hash = space }\\n # TC-3834: the 5xx origin, on status 500 and above only, and only when it is exactly one of the declared codes;\\n # anything else is dropped (the event still ships). A closed vocabulary, never error text.\\n if status >= 500 {\\n error_code = string(f.error_code) ?? \\\"\\\"\\n if includes([\\\"db_error\\\",\\\"db_timeout\\\",\\\"db_busy\\\",\\\"req_timeout\\\",\\\"read_audit\\\",\\\"storage_io\\\",\\\"caveat_db\\\",\\\"read_tx_error\\\",\\\"key_ledger\\\",\\\"lifecycle\\\",\\\"registry_down\\\",\\\"cutover_fence\\\",\\\"kv_candidate\\\",\\\"engine_error\\\",\\\"encryption\\\",\\\"size_limit\\\",\\\"disk_headroom\\\",\\\"internal\\\"], error_code) { out.error_code = error_code }\\n }\\n # TC-3739: per-request DB accounting, on status below 400 only (4xx/5xx are the capped classes; DB-caused 5xx\\n # already carry elapsed_ms on db_failure_5xx). Copied only as plain numbers inside the canonical bounds; anything\\n # else is dropped (the event still ships). They are driver wall times and an attempt count, never identifiers.\\n if status < 400 {\\n pool_wait = f.pool_wait_ms\\n if is_float(pool_wait) || is_integer(pool_wait) {\\n pool_wait = to_float!(pool_wait)\\n if pool_wait >= 0.0 && pool_wait <= 86400000.0 { out.pool_wait_ms = pool_wait }\\n }\\n query_time = f.query_time_ms\\n if is_float(query_time) || is_integer(query_time) {\\n query_time = to_float!(query_time)\\n if query_time >= 0.0 && query_time <= 86400000.0 { out.query_time_ms = query_time }\\n }\\n query_count = f.query_count\\n if is_integer(query_count) {\\n query_count = int!(query_count)\\n if query_count >= 0 && query_count <= 9007199254740991 { out.query_count = query_count }\\n }\\n }\\n } else if is_object(db_event) {\\n out = db_event\\n } else if is_object(headroom) {\\n out = headroom\\n } else if is_object(backfill) {\\n out = backfill\\n } else if is_object(ledger_start) {\\n out = ledger_start\\n } else if is_object(ledger) {\\n out = ledger\\n } else {\\n if !includes([\\\"warn\\\", \\\"error\\\"], level) { abort }\\n code = \\\"unclassified\\\"\\n if target == \\\"tinycloud\\\" || starts_with(target, \\\"tinycloud::\\\") || target == \\\"tinycloud_core\\\" || starts_with(target, \\\"tinycloud_core::\\\") {\\n codes = {\\\"delegation mode boot backfill failed; unmarked rows derive on read\\\":\\\"delegation_mode_boot_backfill_failed\\\",\\\"delegation mode boot reindex skipped rows that failed decryption; leaving unmarked for read-time fail-closed handling\\\":\\\"delegation_mode_boot_reindex_decrypt_failed\\\",\\\"invocation replay insert failed\\\":\\\"invocation_replay_insert_failed\\\",\\\"invocation replay cleanup failed\\\":\\\"invocation_replay_cleanup_failed\\\",\\\"share-v2 local-tee feature active: deriving a deterministic, non-attested TEE identity from node key material\\\":\\\"share_local_tee_identity\\\",\\\"retention: delivered hook delivery prune failed\\\":\\\"retention_hook_delivery_prune_failed\\\",\\\"retention: dead-letter hook delivery prune failed\\\":\\\"retention_dead_letter_prune_failed\\\",\\\"retention: signed KV ticket prune failed\\\":\\\"retention_signed_ticket_prune_failed\\\",\\\"failed to load tunnel state; tunnel not started\\\":\\\"tunnel_state_load_failed\\\",\\\"invalid loopback API address; tunnel not started\\\":\\\"tunnel_address_invalid\\\",\\\"failed to load link state; LAN listener not started\\\":\\\"link_state_load_failed\\\",\\\"invalid link bind address; LAN listener not started\\\":\\\"link_bind_invalid\\\",\\\"invalid loopback API address; LAN listener not started\\\":\\\"link_address_invalid\\\",\\\"failed to bind link LAN listener; LAN listener not started\\\":\\\"link_bind_failed\\\",\\\"failed to build TLS config; LAN listener not started\\\":\\\"link_tls_config_failed\\\",\\\"link LAN listener exited with error\\\":\\\"link_listener_error\\\",\\\"failed to record link listener bind state\\\":\\\"link_listener_state_write_failed\\\",\\\"failed to record link listener bind failure\\\":\\\"link_bind_state_write_failed\\\",\\\"failed to load config for auto-renew\\\":\\\"link_auto_renew_config_failed\\\",\\\"link auto-renew failed\\\":\\\"link_auto_renew_failed\\\",\\\"failed to hot-reload renewed link cert\\\":\\\"link_cert_reload_failed\\\",\\\"link auto-renew succeeded but no state.json found; skipping cert hot-reload\\\":\\\"link_cert_state_missing\\\",\\\"failed to reload TLS material after link auto-renew\\\":\\\"link_listener_cert_reload_failed\\\",\\\"link disable: service delete failed; local state removed anyway\\\":\\\"link_disable_failed\\\",\\\"link connection error\\\":\\\"link_connection_error\\\",\\\"link listener accept error\\\":\\\"link_listener_accept_failed\\\",\\\"webhook delivery attempt failed\\\":\\\"webhook_delivery_failed\\\",\\\"webhook dispatcher loop failed\\\":\\\"webhook_dispatcher_failed\\\",\\\"addressed delegation authorization failed\\\":\\\"share_authorization_failed\\\",\\\"native share authorization denied\\\":\\\"share_native_authorization_denied\\\",\\\"native share KV put failed\\\":\\\"share_native_kv_put_failed\\\",\\\"share v2 readiness probe failed\\\":\\\"share_v2_readiness_failed\\\",\\\"share v2 is enabled but shareEmail.invitationPublicKey is unset\\\":\\\"share_invitation_key_missing\\\",\\\"configured share invitation key does not match the node's derived signing key\\\":\\\"share_invitation_key_mismatch\\\",\\\"share/v2 policy challenge denied\\\":\\\"share_policy_denied\\\",\\\"failed to read committed hook events\\\":\\\"hook_events_read_failed\\\",\\\"failed to load kv write hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"failed to load kv delete hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"missing committed kv hook row for invocation\\\":\\\"missing_committed_hook_row\\\",\\\"database write committed but webhook enqueue failed\\\":\\\"webhook_enqueue_failed\\\",\\\"tunnel: failed to prepare connection attempt\\\":\\\"tunnel_connection_prepare_failed\\\",\\\"tunnel: no frame within idle timeout; treating connection as dead\\\":\\\"tunnel_idle_timeout\\\",\\\"tunnel: read error\\\":\\\"tunnel_read_failed\\\",\\\"tunnel: dropping malformed frame\\\":\\\"tunnel_malformed_frame\\\",\\\"tunnel: relay sent an error frame\\\":\\\"tunnel_relay_error\\\",\\\"tunnel: failed to write frame\\\":\\\"tunnel_write_failed\\\",\\\"tunnel: failed to record runtime state\\\":\\\"tunnel_state_record_failed\\\",\\\"tunnel: failed to clear runtime state after disable\\\":\\\"tunnel_state_clear_failed\\\",\\\"tunnel authentication rejected\\\":\\\"tunnel_auth_rejected\\\",\\\"network DID resolution enabled: did:web/did:tz fetches use the unhardened ssi client (TC-1080)\\\":\\\"network_did_resolution_enabled\\\",\\\"SQL busy: lock wait\\\":\\\"sql_busy_lock_wait\\\",\\\"SQL busy: hydration\\\":\\\"sql_busy_hydration\\\",\\\"SQL busy: artifact transfer\\\":\\\"sql_busy_artifact_transfer\\\",\\\"Request deadline exceeded\\\":\\\"request_timeout\\\",\\\"Request completed after its deadline\\\":\\\"deadline_overrun\\\",\\\"Database hydration gave up loading its artifact\\\":\\\"sql_hydration_timeout\\\",\\\"Read audit wait expired\\\":\\\"read_audit_busy\\\",\\\"Read audit batch slow\\\":\\\"read_audit_batch_slow\\\",\\\"Read audit batch failed\\\":\\\"read_audit_batch_failed\\\",\\\"Read audit drain stalled\\\":\\\"read_audit_drain_stalled\\\",\\\"retrying operation after a lost database connection\\\":\\\"db_operation_retried\\\",\\\"not retrying operation: its first run took longer than the retry window to fail\\\":\\\"db_operation_retry_skipped_slow\\\",\\\"idx_current_kv_space_deleted_key_c is missing; the node keeps serving and KV list requests are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_current_kv_space_deleted_key_c)\\\":\\\"current_kv_c_index_missing\\\",\\\"idx_current_kv_space_deleted_key_c is invalid or still being built; the node keeps serving and KV list requests are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_invalid\\\",\\\"idx_current_kv_space_deleted_key_c exists with the wrong definition and is not used for KV lists; the node keeps serving and KV list requests are slower. Run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_wrong_shape\\\",\\\"idx_kv_write_space_value is missing; the node keeps serving and KV writes that attach a blob are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_kv_write_space_value)\\\":\\\"kv_write_value_index_missing\\\",\\\"idx_kv_write_space_value is invalid or still being built; the node keeps serving and KV writes that attach a blob are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_invalid\\\",\\\"idx_kv_write_space_value exists with the wrong definition and is not used for blob reference checks; the node keeps serving and KV writes that attach a blob are slower. Run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_wrong_shape\\\",\\\"request answered with a 5xx\\\":\\\"http_5xx\\\",\\\"chain guard wait exceeded the slow-wait threshold\\\":\\\"chain_guard_slow_wait\\\",\\\"kv head size probe failed; size omitted\\\":\\\"kv_head_size_probe_failed\\\",\\\"Database checkpoint save failed; refusing its writes until the back-off ends\\\":\\\"sql_checkpoint_save_backoff\\\",\\\"Database exceeds the artifact read limit; not loaded\\\":\\\"sql_database_too_large_to_load\\\",\\\"Database checkpoint exceeds the artifact write limit; not saved\\\":\\\"sql_checkpoint_too_large\\\",\\\"Database checkpoint shrank sharply against the artifact it replaces\\\":\\\"sql_checkpoint_shrank\\\",\\\"Database artifact storage unavailable\\\":\\\"sql_artifact_storage_unavailable\\\",\\\"Database artifact kept changing while it was read\\\":\\\"sql_artifact_changed_during_read\\\",\\\"Artifact part integrity check failed\\\":\\\"artifact_part_hash_mismatch\\\",\\\"Artifact part collection deferred\\\":\\\"artifact_part_collection_deferred\\\",\\\"Durable database artifact does not carry the expected file header; refusing to hydrate\\\":\\\"artifact_header_invalid\\\",\\\"No recorded artifact lineage for a live database; saving without a lineage assertion\\\":\\\"artifact_lineage_missing\\\",\\\"No recorded artifact lineage for a live database; discarding the actor\\\":\\\"artifact_lineage_missing_discarded\\\",\\\"Failed to open database\\\":\\\"database_open_failed\\\",\\\"Failed to promote database to file\\\":\\\"database_promote_failed\\\",\\\"Not enough free disk to promote a database; keeping it in memory\\\":\\\"database_promote_no_disk\\\",\\\"failed to copy view during table copy\\\":\\\"duckdb_view_copy_failed\\\",\\\"Database cache cleanup failed\\\":\\\"duckdb_cache_cleanup_failed\\\",\\\"sql ddl allowed without schema ability (ddl_requires_schema = log)\\\":\\\"sql_ddl_without_schema\\\",\\\"Local SQL commit failed\\\":\\\"sql_commit_failed\\\",\\\"Dead SQL actor detected, respawning\\\":\\\"sql_actor_respawned\\\",\\\"Dead SQL actor detected during export, removing\\\":\\\"sql_actor_dead_on_export\\\",\\\"sql_store shadow upload blocked for a database\\\":\\\"shadow_upload_blocked\\\",\\\"sql_store shadow could not read a manifest row\\\":\\\"shadow_manifest_read_failed\\\",\\\"sql_store shadow lag scan failed\\\":\\\"shadow_lag_scan_failed\\\",\\\"sql_store shadow drained behind PG\\\":\\\"shadow_drained_behind_pg\\\",\\\"sql store mode unreadable; refusing the request\\\":\\\"store_master_mode_unreadable_refused\\\",\\\"store-master backstop rotation failed\\\":\\\"store_master_backstop_rotation_failed\\\",\\\"sql_store: a store-master database has no working copy\\\":\\\"shadow_local_working_copy_missing\\\",\\\"sql_store local source could not read a working copy\\\":\\\"shadow_local_read_failed\\\",\\\"database connection lost\\\":\\\"db_connection_lost\\\",\\\"retries suppressed after a database overload signal\\\":\\\"db_retries_suppressed\\\",\\\"not retrying operation: retries are suppressed after a database overload signal\\\":\\\"db_operation_retry_suppressed\\\",\\\"not retrying operation: the request deadline leaves no room\\\":\\\"db_operation_retry_no_deadline\\\",\\\"retry attempt stopped: the operation budget expired\\\":\\\"db_operation_retry_budget_spent\\\",\\\"Read audit batch timed out\\\":\\\"read_audit_batch_timeout\\\",\\\"failed to refund orphaned KV blob; periodic collector will retry\\\":\\\"kv_blob_refund_failed\\\",\\\"a deleting fence named a blob that a committed write references; it was closed without deleting the blob\\\":\\\"kv_blob_delete_skipped_referenced\\\",\\\"KV orphan collection failed\\\":\\\"kv_orphan_collection_failed\\\",\\\"delegate epoch path failed\\\":\\\"delegate_epoch_path_failed\\\",\\\"epoch insert failed\\\":\\\"epoch_insert_failed\\\",\\\"epoch head backfill stopped at its first error; writes stay correct and repair each space on its next write\\\":\\\"epoch_head_backfill_failed\\\",\\\"invocation referenced a space absent from the database\\\":\\\"invocation_space_missing\\\",\\\"deletion ledger is locked by another process: waiting for it\\\":\\\"deletion_ledger_lock_wait\\\",\\\"deletion ledger replayed at start\\\":\\\"deletion_ledger_replayed\\\",\\\"deletion ledger: committed line was not written\\\":\\\"deletion_ledger_commit_unwritten\\\",\\\"deletion ledger: could not tell whether a delete committed; the operation stays open\\\":\\\"deletion_ledger_commit_unknown\\\",\\\"deletion ledger: the settling line was not written\\\":\\\"deletion_ledger_settle_unwritten\\\",\\\"could not record losing network create ceremony as failed\\\":\\\"network_create_ceremony_mark_failed\\\",\\\"share scope validation failed\\\":\\\"share_scope_validation_failed\\\",\\\"delivery authorization refused\\\":\\\"delivery_authorization_refused\\\",\\\"delivery authorizations refused by the rate limit\\\":\\\"delivery_rate_limited\\\",\\\"deactivated webhook subscriptions; owners must re-register\\\":\\\"hook_subscriptions_deactivated\\\",\\\"webhook egress closed: internal endpoint refresh failed\\\":\\\"webhook_egress_refresh_failed\\\",\\\"webhook egress closed: internal endpoint lookup failed\\\":\\\"webhook_egress_lookup_failed\\\",\\\"webhook delivery mark refused: lease no longer held\\\":\\\"webhook_mark_lease_lost\\\",\\\"webhook delivery lease release failed\\\":\\\"webhook_lease_release_failed\\\",\\\"webhook delivery send skipped: lease no longer held\\\":\\\"webhook_send_lease_lost\\\",\\\"internal renewal scheduler pass failed\\\":\\\"renewal_scheduler_tick_failed\\\",\\\"renewals paused node-wide\\\":\\\"renewals_paused\\\",\\\"renewals resumed node-wide\\\":\\\"renewals_resumed\\\",\\\"the links API clock differs from the node clock\\\":\\\"links_read_clock_skew\\\",\\\"purge ledger reconciliation failed; space traffic stays refused\\\":\\\"space_purge_reconcile_failed\\\",\\\"space purge residue sweep failed\\\":\\\"space_purge_sweep_failed\\\",\\\"space purge phase failed; retrying later\\\":\\\"space_purge_phase_failed\\\",\\\"space purge attempt release failed\\\":\\\"space_purge_release_failed\\\",\\\"space purge claim failed\\\":\\\"space_purge_claim_failed\\\",\\\"owner erasure pass failed; retrying later\\\":\\\"owner_erasure_pass_failed\\\",\\\"skipped invalid space directories while measuring storage\\\":\\\"storage_invalid_space_dirs\\\",\\\"removed setting is set and ignored; delete it from the configuration\\\":\\\"removed_setting_ignored\\\",\\\"admin stats result exceeds its bound\\\":\\\"admin_stats_over_bound\\\",\\\"admin stats query failed\\\":\\\"admin_stats_query_failed\\\",\\\"TDX quote unavailable\\\":\\\"attestation_quote_unavailable\\\",\\\"dstack guest agent returned an error\\\":\\\"dstack_guest_agent_error\\\",\\\"tunnel: failed to build upstream HTTP client\\\":\\\"tunnel_upstream_client_failed\\\"}\\n known = get(codes, [msg]) ?? null\\n if is_string(known) { code = known }\\n if starts_with(msg, \\\"quota service returned \\\") { code = \\\"quota_fallback\\\" }\\nif starts_with(msg, \\\"Failed to get TDX quote: \\\") { code = \\\"attestation_quote_failed\\\" }\\nif starts_with(msg, \\\"created a new node identity at \\\") { code = \\\"node_identity_created\\\" }\\nif starts_with(msg, \\\"quota service returned an invalid body: \\\") { code = \\\"quota_invalid_body\\\" }\\nif starts_with(msg, \\\"dstack socket available but get_info failed: \\\") { code = \\\"dstack_get_info_failed\\\" }\\n # TC-3284: a line with no message is named by its constant `event` field, only when that event is listed.\\n if msg == \\\"\\\" && !exists(f.message) {\\n events = {\\\"did_resolution_refused\\\":\\\"did_resolution_refused\\\",\\\"renewal_scheduler_lease_failed\\\":\\\"renewal_scheduler_lease_failed\\\",\\\"session_retire_failed\\\":\\\"session_retire_failed\\\"}\\n named = get(events, [string(f.event) ?? \\\"\\\"]) ?? null\\n if is_string(named) { code = named }\\n }\\n }\\n if level == \\\"warn\\\" && target == \\\"rocket::config::config\\\" && msg == \\\"found value for deprecated config key `log`\\\" { code = \\\"rocket_deprecated_log_config\\\" }\\nif level == \\\"warn\\\" && target == \\\"rocket::launch\\\" && starts_with(msg, \\\"Rocket has launched from \\\") { code = \\\"rocket_launched\\\" }\\n event = if level == \\\"warn\\\" { \\\"node_warning\\\" } else { \\\"node_error\\\" }\\n out = {\\\"event\\\": event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": level, \\\"event_code\\\": code, \\\"event_count\\\": 1}\\n }\\n} else {\\n ts = string!(j.time)\\n method = string!(j.method)\\n route = string!(j.route)\\n if route == \\\"\\\" { route = \\\"\\\" }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = j.status\\n request_time = j.request_time\\n if !is_integer(status) || !(is_integer(request_time) || is_float(request_time)) { abort }\\n status = int!(status)\\n request_time = to_float!(request_time)\\n if status < 100 || status > 599 || request_time < 0 || request_time > 86400 { abort }\\n out = {\\\"event\\\": \\\"ingress_request\\\", \\\"svc\\\": \\\"ingress\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"request_time_seconds\\\": request_time}\\n}\\nif length(ts) > 64 { abort }\\nparsed_ts = parse_timestamp!(ts, format: \\\"%+\\\")\\nout.ts = format_timestamp!(parsed_ts, format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\")\\n. = out\\n\",\"drop_on_error\":true,\"drop_on_abort\":true,\"reroute_dropped\":true},\"gate_counts\":{\"type\":\"remap\",\"inputs\":[\"gate_route.rejected\",\"gate_route._unmatched\",\"allowlist.dropped\",\"event_route._unmatched\"],\"source\":\"reason = .reason\\nif !includes([\\\"malformed_envelope\\\",\\\"unexpected_label\\\",\\\"unlabelled\\\",\\\"non_json\\\",\\\"oversized\\\",\\\"partial\\\",\\\"invalid_fields\\\",\\\"unknown_target\\\",\\\"filtered_level\\\"], reason) { reason = \\\"invalid_fields\\\" }\\n. = {\\\"reason\\\": reason, \\\"count\\\": 1}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_reduce\":{\"type\":\"reduce\",\"inputs\":[\"gate_counts\"],\"group_by\":[\"reason\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"count\":\"sum\"}},\"gate_output\":{\"type\":\"remap\",\"inputs\":[\"gate_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": \\\"warn\\\", \\\"event\\\": \\\"logship_gate_summary_total\\\", \\\"svc\\\": \\\"logship\\\", \\\"reason\\\": .reason, \\\"count\\\": .count}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"request_profile\":{\"type\":\"filter\",\"inputs\":[\"allowlist\"],\"condition\":\"\\\"$${TINYCLOUD_LOGSHIP_PROFILE}\\\" == \\\"all_requests\\\" || includes([\\\"node_warning\\\",\\\"node_error\\\",\\\"node_storage_headroom\\\",\\\"delegation_mode_boot_reindex\\\",\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\",\\\"deletion_ledger_start\\\"], .event) || (int(.status) ?? 0) >= 400 || (.event == \\\"node_request\\\" && (int(.latency_us) ?? 0) > 1000000) || (.event == \\\"ingress_request\\\" && (to_float(.request_time_seconds) ?? 0.0) > 1.000000)\"},\"event_route\":{\"type\":\"route\",\"inputs\":[\"request_profile\"],\"route\":{\"request\":\"(.event == \\\"node_request\\\" || .event == \\\"ingress_request\\\") && !(((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)) && !((int(.status) ?? 0) >= 500)\",\"node_request_5xx\":\".event == \\\"node_request\\\" && (int(.status) ?? 0) >= 500\",\"ingress_request_5xx\":\".event == \\\"ingress_request\\\" && (int(.status) ?? 0) >= 500\",\"node_request_4xx\":\".event == \\\"node_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"ingress_request_4xx\":\".event == \\\"ingress_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"db_failure_5xx\":\".event == \\\"node_warning\\\" && .event_code == \\\"db_failure_5xx\\\"\",\"storage_headroom\":\".event == \\\"node_storage_headroom\\\"\",\"delegation_mode_boot_reindex\":\".event == \\\"delegation_mode_boot_reindex\\\"\",\"deletion_ledger\":\"includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event)\",\"deletion_ledger_start\":\".event == \\\"deletion_ledger_start\\\"\",\"diagnostic\":\"(.event == \\\"node_warning\\\" && .event_code != \\\"db_failure_5xx\\\") || .event == \\\"node_error\\\"\"}},\"cap_db_failure_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.db_failure_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"db_failure_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"diagnostic_reduce\":{\"type\":\"reduce\",\"inputs\":[\"event_route.diagnostic\"],\"group_by\":[\"event\",\"event_code\",\"level\",\"svc\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"event_count\":\"sum\",\"ts\":\"discard\"}},\"diagnostic_output\":{\"type\":\"remap\",\"inputs\":[\"diagnostic_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": .level, \\\"event\\\": .event, \\\"svc\\\": \\\"api\\\", \\\"event_code\\\": .event_code, \\\"event_count\\\": .event_count}\",\"drop_on_error\":true,\"drop_on_abort\":true}},\"sinks\":{\"betterstack\":{\"type\":\"http\",\"inputs\":[\"event_route.request\",\"event_route.storage_headroom\",\"event_route.delegation_mode_boot_reindex\",\"event_route.deletion_ledger\",\"event_route.deletion_ledger_start\",\"cap_db_failure_5xx\",\"cap_node_request_5xx\",\"cap_ingress_request_5xx\",\"cap_node_request_4xx\",\"cap_ingress_request_4xx\",\"diagnostic_output\",\"gate_output\"],\"method\":\"post\",\"uri\":\"https://s2795437.us-west-2a.betterstackdata.com/\",\"encoding\":{\"codec\":\"json\"},\"framing\":{\"method\":\"newline_delimited\"},\"compression\":\"gzip\",\"auth\":{\"strategy\":\"bearer\",\"token\":\"SECRET[bs.bs_token]\"},\"batch\":{\"max_bytes\":262144,\"timeout_secs\":1},\"buffer\":{\"type\":\"memory\",\"max_events\":1000,\"when_full\":\"block\"},\"request\":{\"timeout_secs\":10,\"retry_max_duration_secs\":300},\"healthcheck\":{\"enabled\":false}}},\"secret\":{\"bs\":{\"type\":\"directory\",\"path\":\"/var/lib/vector/secrets\",\"remove_trailing_whitespace\":true}}}" entrypoint: - /bin/sh - -ec diff --git a/docs/releasing.md b/docs/releasing.md index d0b908f9..0bd28bf9 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -746,8 +746,8 @@ Before any CVM mutation the workflow requires: - the main compose, with its one node digest replaced by 64 zeros, to hash to the reviewed N0 template - **`4520ee72189db061788d2a3f09c742fdae5aa8709717a5d983c6ee77e91ca4d0`** - (raw `fdcf54f255fd529f029fa1e3e66b5c0ecd5f3b4d3e8f0af96582ae213bd9f46b` normalized). Before the TC-4177 deletion ledger start line (`deletion_ledger_start`) and the TC-4190 `duckdb_cache_cleanup_failed` code in the Vector config the template was `a6902dd53525d2392146ef913f81bbdd19248116304a7f100fab206666e6b71c` + **`693f06e86e0ea576a435b891214e9aaf528204c66131d85f53b4a805f8c47a60`** + (raw `ef81b59ff3034ff17c049ac281173c4ac69ee8036f4d6333b19ed260c60e71b9` normalized). Before the TC-4177 deletion ledger start line (`deletion_ledger_start`), the TC-4190 `duckdb_cache_cleanup_failed` code and the four TC-1491 P4.2a codes (`store_master_mode_unreadable_refused`, `store_master_backstop_rotation_failed`, `shadow_local_working_copy_missing`, `shadow_local_read_failed`) in the Vector config the template was `a6902dd53525d2392146ef913f81bbdd19248116304a7f100fab206666e6b71c` (raw `a52a126def0557db35c46c37477646cb7c2d26490b873b72223235e15c56d69c` normalized, with the TC-4249 ingress pin); before that pin the template was `91802e6cbec5eee1473d8bb63def043cc9e676c807b87904408bf44a2bc12adb` (raw `68f008731b6c013a79dad6f17a0d7a4d141505c31b52a8a98f1acdb571c059d4` normalized). Before the TC-4194 `cloudflared` connector service (pinned by digest, no published ports, on its own `cf-edge` network shared only with `tinycloud`, optional sealed `CLOUDFLARE_TUNNEL_TOKEN`) the template was `8c8785fbc80e2dc16358abe0304cec32235367c9b9cfc5e1776704f7019af4f8` (raw `7cc95bde531f100148a8bbcc8a8d104144d75e382873362dd6fb76b88403f27e` normalized). Before TC-3973 startup diagnostics and reindex counts in the Vector config the template was `e0f99bcca6f220c65d81cad15504790099d634243ea701350a509e995b672aa0` @@ -964,7 +964,7 @@ gh workflow run docker.yml -R TinyCloudLabs/tinycloud-node --ref main \ The served/OCI identity remains **1.20.6-dstack / e18578ff9162986ddd813259c60f73866e3e60d1**. With the template lock on main this redeploys exactly main's raw compose -`fdcf54f255fd529f029fa1e3e66b5c0ecd5f3b4d3e8f0af96582ae213bd9f46b` +`ef81b59ff3034ff17c049ac281173c4ac69ee8036f4d6333b19ed260c60e71b9` (the 1.21.0 compose `d95bfb70…` with the TC-1274, TC-1317, TC-1482, `current_kv_c_index_*`, `db_failure_5xx`, the 4xx and 5xx caps, `errors_dropped`, TC-2346 `db_operation_retried` / `db_operation_retry_skipped_slow`, TC-2917 `node_storage_headroom`, TC-3739 `node_request` DB timing, TC-3834 `node_request` `error_code`, TC-3284 deletion ledger error event and TC-3284 named node diagnostics and TC-3973 startup events and TC-4177 `deletion_ledger_start` and TC-4190 `duckdb_cache_cleanup_failed` in the Vector config, the optional TC-1482 `NODE_STATS_READ_TOKEN` env line, the TC-950 pool of 10, the TC-1777 `NAMED_KEYS_V1` gate env lines with the `deletion-ledger` volume, the TC-1491 artifact read limit env line, the TC-3554 `TINYCLOUD_KEYS__TYPE: DstackKmsEpoch` pins with no key-recovery sidecar, the TC-287 `TINYCLOUD_RETENTION__ENABLED: "true"` env line, the TC-1791 `TINYCLOUD_SQL__DELEGATED_CAVEATS_ENFORCED: "true"` env line and the TC-1491 `TINYCLOUD_STORAGE__SQL__MAX_DATABASE_BYTES: "320 MiB"` / `MIN_FREE_BYTES: "1 GiB"` env lines), whatever digest main's template currently pins. **Since TC-3554 only 1.26.15 or later boots on this compose, and only once the database holds the `root_wrap` blob:** diff --git a/log-shipper/canonical.json b/log-shipper/canonical.json index ab99e1b3..39cc6918 100644 --- a/log-shipper/canonical.json +++ b/log-shipper/canonical.json @@ -1,6 +1,6 @@ { "repo": "samgbafa/tinycloud-dev", - "revision": "a33ebf8d198452db8b1538ad8f6e4a34ff70cc76", + "revision": "764c32a9c3a8cc9f050f10e40a46e47cabfbe9eb", "path": "ops/logging/fields.json", - "sha256": "4143ff5019de70af6ceedca0e895f82bb5b3acccbcfd93d7667b84e4210d1653" + "sha256": "9abea684d4b9e396f67b7a612733d6f788d35f9b1a5ae806430644b6c3a2ba9b" } diff --git a/log-shipper/diagnostics.json b/log-shipper/diagnostics.json index 224ec2e2..e4245d66 100644 --- a/log-shipper/diagnostics.json +++ b/log-shipper/diagnostics.json @@ -104,6 +104,10 @@ "sql_store shadow could not read a manifest row": "shadow_manifest_read_failed", "sql_store shadow lag scan failed": "shadow_lag_scan_failed", "sql_store shadow drained behind PG": "shadow_drained_behind_pg", + "sql store mode unreadable; refusing the request": "store_master_mode_unreadable_refused", + "store-master backstop rotation failed": "store_master_backstop_rotation_failed", + "sql_store: a store-master database has no working copy": "shadow_local_working_copy_missing", + "sql_store local source could not read a working copy": "shadow_local_read_failed", "database connection lost": "db_connection_lost", "retries suppressed after a database overload signal": "db_retries_suppressed", "not retrying operation: retries are suppressed after a database overload signal": "db_operation_retry_suppressed", diff --git a/log-shipper/fields.json b/log-shipper/fields.json index 11fc8e08..1362f041 100644 --- a/log-shipper/fields.json +++ b/log-shipper/fields.json @@ -100,7 +100,7 @@ "query_time_ms": { "type": "number", "min": 0, "max": 86400000 }, "query_count": { "type": "integer", "min": 0, "max": 9007199254740991 }, "error_code": { "type": "enum", "values": ["db_error", "db_timeout", "db_busy", "req_timeout", "read_audit", "storage_io", "caveat_db", "read_tx_error", "key_ledger", "lifecycle", "registry_down", "cutover_fence", "kv_candidate", "engine_error", "encryption", "size_limit", "disk_headroom", "internal"] }, - "event_code": { "type": "enum", "values": ["invocation_replay_insert_failed", "invocation_replay_cleanup_failed", "dstack_get_info_failed", "share_local_tee_identity", "retention_hook_delivery_prune_failed", "retention_dead_letter_prune_failed", "retention_signed_ticket_prune_failed", "quota_invalid_body", "quota_fallback", "tunnel_state_load_failed", "tunnel_address_invalid", "link_state_load_failed", "link_bind_invalid", "link_address_invalid", "link_bind_failed", "link_bind_state_write_failed", "link_tls_config_failed", "link_listener_error", "link_listener_state_write_failed", "link_auto_renew_config_failed", "link_auto_renew_failed", "link_cert_reload_failed", "link_cert_state_missing", "link_listener_cert_reload_failed", "link_disable_failed", "link_connection_error", "link_listener_accept_failed", "webhook_delivery_failed", "webhook_dispatcher_failed", "share_authorization_failed", "share_native_authorization_denied", "share_native_kv_put_failed", "share_v2_readiness_failed", "share_invitation_key_missing", "share_invitation_key_mismatch", "share_policy_denied", "attestation_quote_failed", "hook_events_read_failed", "hook_rows_load_failed", "missing_committed_hook_row", "webhook_enqueue_failed", "tunnel_connection_prepare_failed", "tunnel_idle_timeout", "tunnel_read_failed", "tunnel_malformed_frame", "tunnel_relay_error", "tunnel_write_failed", "tunnel_state_record_failed", "tunnel_state_clear_failed", "tunnel_auth_rejected", "network_did_resolution_enabled", "unclassified", "sql_busy_lock_wait", "sql_busy_hydration", "sql_busy_artifact_transfer", "request_timeout", "deadline_overrun", "sql_hydration_timeout", "read_audit_busy", "read_audit_batch_slow", "read_audit_batch_failed", "read_audit_drain_stalled", "current_kv_c_index_missing", "current_kv_c_index_invalid", "current_kv_c_index_wrong_shape", "db_operation_retried", "db_operation_retry_skipped_slow", "db_failure_5xx", "errors_dropped", "http_5xx", "chain_guard_slow_wait", "db_pool_closed_in_transaction", "sql_database_too_large_to_load", "sql_checkpoint_save_backoff", "kv_head_size_probe_failed", "invoke_rate_limited", "account_limited", "node_top_talkers", "kv_write_value_index_missing", "kv_write_value_index_invalid", "kv_write_value_index_wrong_shape", "sql_checkpoint_too_large", "sql_checkpoint_shrank", "sql_artifact_storage_unavailable", "sql_artifact_changed_during_read", "artifact_part_hash_mismatch", "artifact_part_collection_deferred", "artifact_header_invalid", "artifact_lineage_missing", "artifact_lineage_missing_discarded", "database_open_failed", "database_promote_failed", "database_promote_no_disk", "duckdb_view_copy_failed", "sql_ddl_without_schema", "sql_commit_failed", "sql_actor_respawned", "sql_actor_dead_on_export", "shadow_upload_blocked", "shadow_manifest_read_failed", "shadow_lag_scan_failed", "shadow_drained_behind_pg", "db_connection_lost", "db_retries_suppressed", "db_operation_retry_suppressed", "db_operation_retry_no_deadline", "db_operation_retry_budget_spent", "read_audit_batch_timeout", "kv_blob_refund_failed", "kv_blob_delete_skipped_referenced", "kv_orphan_collection_failed", "delegate_epoch_path_failed", "epoch_insert_failed", "epoch_head_backfill_failed", "invocation_space_missing", "deletion_ledger_lock_wait", "deletion_ledger_replayed", "deletion_ledger_commit_unwritten", "deletion_ledger_commit_unknown", "deletion_ledger_settle_unwritten", "network_create_ceremony_mark_failed", "share_scope_validation_failed", "delivery_authorization_refused", "delivery_rate_limited", "hook_subscriptions_deactivated", "webhook_egress_refresh_failed", "webhook_egress_lookup_failed", "webhook_mark_lease_lost", "webhook_lease_release_failed", "webhook_send_lease_lost", "renewal_scheduler_tick_failed", "renewals_paused", "renewals_resumed", "links_read_clock_skew", "space_purge_reconcile_failed", "space_purge_sweep_failed", "space_purge_phase_failed", "space_purge_release_failed", "space_purge_claim_failed", "owner_erasure_pass_failed", "storage_invalid_space_dirs", "removed_setting_ignored", "admin_stats_over_bound", "admin_stats_query_failed", "attestation_quote_unavailable", "dstack_guest_agent_error", "tunnel_upstream_client_failed", "node_identity_created", "did_resolution_refused", "renewal_scheduler_lease_failed", "session_retire_failed", "delegation_mode_boot_backfill_failed", "delegation_mode_boot_reindex_decrypt_failed", "rocket_deprecated_log_config", "rocket_launched", "delegation_mode_boot_reindex_complete", "delegation_mode_boot_reindex_incomplete", "delegation_mode_boot_reindex_lock_timeout", "duckdb_cache_cleanup_failed"] }, + "event_code": { "type": "enum", "values": ["invocation_replay_insert_failed", "invocation_replay_cleanup_failed", "dstack_get_info_failed", "share_local_tee_identity", "retention_hook_delivery_prune_failed", "retention_dead_letter_prune_failed", "retention_signed_ticket_prune_failed", "quota_invalid_body", "quota_fallback", "tunnel_state_load_failed", "tunnel_address_invalid", "link_state_load_failed", "link_bind_invalid", "link_address_invalid", "link_bind_failed", "link_bind_state_write_failed", "link_tls_config_failed", "link_listener_error", "link_listener_state_write_failed", "link_auto_renew_config_failed", "link_auto_renew_failed", "link_cert_reload_failed", "link_cert_state_missing", "link_listener_cert_reload_failed", "link_disable_failed", "link_connection_error", "link_listener_accept_failed", "webhook_delivery_failed", "webhook_dispatcher_failed", "share_authorization_failed", "share_native_authorization_denied", "share_native_kv_put_failed", "share_v2_readiness_failed", "share_invitation_key_missing", "share_invitation_key_mismatch", "share_policy_denied", "attestation_quote_failed", "hook_events_read_failed", "hook_rows_load_failed", "missing_committed_hook_row", "webhook_enqueue_failed", "tunnel_connection_prepare_failed", "tunnel_idle_timeout", "tunnel_read_failed", "tunnel_malformed_frame", "tunnel_relay_error", "tunnel_write_failed", "tunnel_state_record_failed", "tunnel_state_clear_failed", "tunnel_auth_rejected", "network_did_resolution_enabled", "unclassified", "sql_busy_lock_wait", "sql_busy_hydration", "sql_busy_artifact_transfer", "request_timeout", "deadline_overrun", "sql_hydration_timeout", "read_audit_busy", "read_audit_batch_slow", "read_audit_batch_failed", "read_audit_drain_stalled", "current_kv_c_index_missing", "current_kv_c_index_invalid", "current_kv_c_index_wrong_shape", "db_operation_retried", "db_operation_retry_skipped_slow", "db_failure_5xx", "errors_dropped", "http_5xx", "chain_guard_slow_wait", "db_pool_closed_in_transaction", "sql_database_too_large_to_load", "sql_checkpoint_save_backoff", "kv_head_size_probe_failed", "invoke_rate_limited", "account_limited", "node_top_talkers", "kv_write_value_index_missing", "kv_write_value_index_invalid", "kv_write_value_index_wrong_shape", "sql_checkpoint_too_large", "sql_checkpoint_shrank", "sql_artifact_storage_unavailable", "sql_artifact_changed_during_read", "artifact_part_hash_mismatch", "artifact_part_collection_deferred", "artifact_header_invalid", "artifact_lineage_missing", "artifact_lineage_missing_discarded", "database_open_failed", "database_promote_failed", "database_promote_no_disk", "duckdb_view_copy_failed", "sql_ddl_without_schema", "sql_commit_failed", "sql_actor_respawned", "sql_actor_dead_on_export", "shadow_upload_blocked", "shadow_manifest_read_failed", "shadow_lag_scan_failed", "shadow_drained_behind_pg", "store_master_mode_unreadable_refused", "store_master_backstop_rotation_failed", "shadow_local_working_copy_missing", "shadow_local_read_failed", "db_connection_lost", "db_retries_suppressed", "db_operation_retry_suppressed", "db_operation_retry_no_deadline", "db_operation_retry_budget_spent", "read_audit_batch_timeout", "kv_blob_refund_failed", "kv_blob_delete_skipped_referenced", "kv_orphan_collection_failed", "delegate_epoch_path_failed", "epoch_insert_failed", "epoch_head_backfill_failed", "invocation_space_missing", "deletion_ledger_lock_wait", "deletion_ledger_replayed", "deletion_ledger_commit_unwritten", "deletion_ledger_commit_unknown", "deletion_ledger_settle_unwritten", "network_create_ceremony_mark_failed", "share_scope_validation_failed", "delivery_authorization_refused", "delivery_rate_limited", "hook_subscriptions_deactivated", "webhook_egress_refresh_failed", "webhook_egress_lookup_failed", "webhook_mark_lease_lost", "webhook_lease_release_failed", "webhook_send_lease_lost", "renewal_scheduler_tick_failed", "renewals_paused", "renewals_resumed", "links_read_clock_skew", "space_purge_reconcile_failed", "space_purge_sweep_failed", "space_purge_phase_failed", "space_purge_release_failed", "space_purge_claim_failed", "owner_erasure_pass_failed", "storage_invalid_space_dirs", "removed_setting_ignored", "admin_stats_over_bound", "admin_stats_query_failed", "attestation_quote_unavailable", "dstack_guest_agent_error", "tunnel_upstream_client_failed", "node_identity_created", "did_resolution_refused", "renewal_scheduler_lease_failed", "session_retire_failed", "delegation_mode_boot_backfill_failed", "delegation_mode_boot_reindex_decrypt_failed", "rocket_deprecated_log_config", "rocket_launched", "delegation_mode_boot_reindex_complete", "delegation_mode_boot_reindex_incomplete", "delegation_mode_boot_reindex_lock_timeout", "duckdb_cache_cleanup_failed"] }, "event_count": { "type": "integer", "min": 1, "max": 9007199254740991 }, "reason": { "type": "enum", "values": ["malformed_envelope", "unexpected_label", "unlabelled", "non_json", "oversized", "partial", "invalid_fields", "unknown_target", "filtered_level"] }, "count": { "type": "integer", "min": 1, "max": 9007199254740991 }, diff --git a/log-shipper/ledger-start.test.mjs b/log-shipper/ledger-start.test.mjs index 9563fe85..0d3e6eed 100644 --- a/log-shipper/ledger-start.test.mjs +++ b/log-shipper/ledger-start.test.mjs @@ -44,3 +44,17 @@ test('the DuckDB cache cleanup warning is a warn! carrying its event and a mappe assert.equal(diagnostics.exact['Database cache cleanup failed'], 'duckdb_cache_cleanup_failed'); assert.ok(nodeSchema.fields.event_code.values.includes('duckdb_cache_cleanup_failed')); }); + +test('the four TC-1491 P4.2a messages map to schema codes before their emitting code lands', async () => { + const { exact } = JSON.parse(await source('log-shipper/diagnostics.json')); + const expected = { + 'sql store mode unreadable; refusing the request': 'store_master_mode_unreadable_refused', + 'store-master backstop rotation failed': 'store_master_backstop_rotation_failed', + 'sql_store: a store-master database has no working copy': 'shadow_local_working_copy_missing', + 'sql_store local source could not read a working copy': 'shadow_local_read_failed', + }; + for (const [message, code] of Object.entries(expected)) { + assert.equal(exact[message], code, message); + assert.ok(nodeSchema.fields.event_code.values.includes(code), code); + } +}); diff --git a/scripts/ci/fixtures/tc959-n0-compose.yaml b/scripts/ci/fixtures/tc959-n0-compose.yaml index d8c778c4..71b19e4a 100644 --- a/scripts/ci/fixtures/tc959-n0-compose.yaml +++ b/scripts/ci/fixtures/tc959-n0-compose.yaml @@ -275,7 +275,7 @@ services: environment: TINYCLOUD_LOGSHIP_PROFILE: ${TINYCLOUD_LOGSHIP_PROFILE:-errors_slow} BETTERSTACK_SOURCE_TOKEN: ${BETTERSTACK_SOURCE_TOKEN:?seal the node source token before enabling log shipping} - VECTOR_CONFIG_JSON: "{\"data_dir\":\"/var/lib/vector\",\"sources\":{\"gelf_in\":{\"type\":\"socket\",\"mode\":\"udp\",\"address\":\"0.0.0.0:12201\",\"max_length\":262144,\"receive_buffer_bytes\":8388608,\"framing\":{\"method\":\"chunked_gelf\",\"chunked_gelf\":{\"decompression\":\"Auto\"}},\"decoding\":{\"codec\":\"bytes\"}}},\"transforms\":{\"gelf_envelope\":{\"type\":\"remap\",\"inputs\":[\"gelf_in\"],\"source\":\"packet = string(.message) ?? \\\"\\\"\\nif length(packet) > 262144 {\\n . = {\\\"reason\\\": \\\"oversized\\\"}\\n} else {\\n outer, err = parse_json(packet)\\n if err != null || !is_object(outer) || (outer.version != \\\"1.1\\\" && outer.version != \\\"1.0\\\") {\\n . = {\\\"reason\\\": \\\"malformed_envelope\\\"}\\n } else if exists(outer.partial_message) || exists(outer._partial_message) {\\n . = {\\\"reason\\\": \\\"partial\\\"}\\n } else {\\n label = get(outer, [\\\"_tc.logship\\\"]) ?? null\\n . = {\\\"_tc.logship\\\": label, \\\"message\\\": outer.short_message}\\n }\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"logship_gate\":{\"type\":\"remap\",\"inputs\":[\"gelf_envelope\"],\"source\":\"if exists(.reason) {\\n . = {\\\"reason\\\": .reason}\\n} else {\\nlabel = string(get(., [\\\"_tc.logship\\\"]) ?? null) ?? \\\"\\\"\\nraw = .message\\nreason = \\\"\\\"\\nif label == \\\"\\\" { reason = \\\"unlabelled\\\" }\\nelse if !includes([\\\"tinycloud-node\\\", \\\"tinycloud-ingress\\\"], label) { reason = \\\"unexpected_label\\\" }\\nelse if exists(.partial_message) { reason = \\\"partial\\\" }\\nelse if !is_string(raw) { reason = \\\"malformed_envelope\\\" }\\nelse if length(string!(raw)) > 65536 { reason = \\\"oversized\\\" }\\nif reason != \\\"\\\" {\\n . = {\\\"reason\\\": reason}\\n} else {\\n parsed, err = parse_json(string!(raw))\\n if err != null || !is_object(parsed) { . = {\\\"reason\\\": \\\"non_json\\\"} }\\n else if exists(parsed.partial_message) { . = {\\\"reason\\\": \\\"partial\\\"} }\\n else {\\n target = string(parsed.target) ?? \\\"\\\"\\n level = downcase(string(parsed.level) ?? \\\"\\\")\\n gate_fields = object(parsed.fields) ?? {}\\n gate_event = string(gate_fields.event) ?? \\\"\\\"\\n if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && target != \\\"tinycloud\\\" && !starts_with(target, \\\"tinycloud::\\\") && target != \\\"tinycloud_core\\\" && !starts_with(target, \\\"tinycloud_core::\\\") {\\n . = {\\\"reason\\\": \\\"unknown_target\\\"}\\n } else if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && !((target == \\\"tinycloud::request\\\" || target == \\\"tinycloud::disk_headroom\\\" || target == \\\"tinycloud_core::models::delegation_mode\\\" || (target == \\\"tinycloud\\\" && gate_event == \\\"deletion_ledger_start\\\")) && level == \\\"info\\\") {\\n . = {\\\"reason\\\": \\\"filtered_level\\\"}\\n } else { . = {\\\"label\\\": label, \\\"parsed\\\": parsed} }\\n }\\n}\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_route\":{\"type\":\"route\",\"inputs\":[\"logship_gate\"],\"route\":{\"candidate\":\"exists(.parsed)\",\"rejected\":\"exists(.reason)\"}},\"allowlist\":{\"type\":\"remap\",\"inputs\":[\"gate_route.candidate\"],\"source\":\"# Only this fresh object can leave the process boundary. No envelope, span,\\n# message, error, identity, URI or unknown key is copied into it.\\nj = .parsed\\nlabel = .label\\nout = {}\\nts = \\\"\\\"\\nif label == \\\"tinycloud-node\\\" {\\n target = string(j.target) ?? \\\"\\\"\\n level = downcase(string!(j.level))\\n f = object(j.fields) ?? {}\\n msg = string(f.message) ?? \\\"\\\"\\n ts = string!(j.timestamp)\\n # Literal Rocket template aliases only; never split an arbitrary URI.\\n aliases = {\\\"/attestation?\\\":\\\"/attestation\\\",\\\"/.well-known/encryption/network/?\\\":\\\"/.well-known/encryption/network/\\\",\\\"/hooks/events?\\\":\\\"/hooks/events\\\",\\\"/hooks/webhooks?\\\":\\\"/hooks/webhooks\\\",\\\"/public//kv?\\\":\\\"/public//kv\\\"}\\n # TC-1840: the node's one 5xx diagnostic line per database failure ships as an individual event.\\n # The input must carry exactly the declared keys (the message plus these seven, and db_hash only\\n # when it is a valid pseudonym) with exactly the declared types and enum values. Anything else\\n # leaves db_event null and the line falls back to the unclassified count below; no value of it\\n # is ever copied unless it passed, and the shipped object is built from literals and the\\n # validated values only.\\n db_event = null\\n if target == \\\"tinycloud::request\\\" && level == \\\"warn\\\" && msg == \\\"database failure answered with a 5xx\\\" {\\n db_status = f.status\\n db_elapsed = f.elapsed_ms\\n db_code = string(f.code) ?? \\\"\\\"\\n db_service = string(f.service) ?? \\\"\\\"\\n db_kind = string(f.failure_kind) ?? \\\"\\\"\\n db_route = string(f.route) ?? \\\"\\\"\\n db_canonical_route = get(aliases, [db_route]) ?? null\\n if is_string(db_canonical_route) { db_route = db_canonical_route }\\n db_ok = is_integer(db_status) && is_integer(db_elapsed) && is_boolean(f.write_may_have_applied)\\n if db_ok {\\n db_status = int!(db_status)\\n db_elapsed = int!(db_elapsed)\\n db_ok = db_status >= 500 && db_status <= 599 && db_elapsed >= 0 && db_elapsed <= 9007199254740991 && includes([\\\"unavailable_retryable\\\",\\\"outcome_unknown\\\",\\\"internal\\\",\\\"sql_busy\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\"], db_code) && includes([\\\"sql\\\",\\\"duckdb\\\",\\\"kv\\\",\\\"other\\\"], db_service) && includes([\\\"pool_timeout\\\",\\\"pool_closed\\\",\\\"io\\\",\\\"statement_timeout\\\",\\\"serialization\\\",\\\"connection_lost\\\",\\\"artifact_changed\\\",\\\"lock_wait\\\",\\\"hydration\\\",\\\"artifact_transfer\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\",\\\"other\\\"], db_kind) && includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], db_route)\\n }\\n db_hash = string(f.db_hash) ?? \\\"\\\"\\n has_db_hash = exists(f.db_hash)\\n if db_ok {\\n if has_db_hash { db_ok = match(db_hash, r'^[0-9a-f]{64}$') && length(f) == 9 } else { db_ok = length(f) == 8 }\\n }\\n if db_ok {\\n db_event = {\\\"event\\\": \\\"node_warning\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"warn\\\", \\\"event_code\\\": \\\"db_failure_5xx\\\", \\\"status\\\": db_status, \\\"code\\\": db_code, \\\"service\\\": db_service, \\\"route\\\": db_route, \\\"elapsed_ms\\\": db_elapsed, \\\"failure_kind\\\": db_kind, \\\"write_may_have_applied\\\": bool!(f.write_may_have_applied)}\\n if has_db_hash { db_event.db_hash = db_hash }\\n }\\n }\\n # TC-2917: the node's periodic disk headroom line (one per local store) ships as an individual\\n # info event. Exactly the message plus `store` (a declared store) and `free_bytes` (a bounded\\n # integer in whole 64 MiB steps, as the node rounds it); anything else leaves headroom null, and\\n # the info line is then dropped below.\\n headroom = null\\n if target == \\\"tinycloud::disk_headroom\\\" && level == \\\"info\\\" && msg == \\\"storage headroom\\\" && length(f) == 3 {\\n h_store = string(f.store) ?? \\\"\\\"\\n h_free = f.free_bytes\\n if includes([\\\"sql\\\",\\\"duckdb\\\"], h_store) && is_integer(h_free) {\\n h_free = int!(h_free)\\n if h_free >= 0 && h_free <= 9007199254740991 && mod(h_free, 67108864) == 0 {\\n headroom = {\\\"event\\\": \\\"node_storage_headroom\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"store\\\": h_store, \\\"free_bytes\\\": h_free}\\n }\\n }\\n }\\n # TC-3973: ship the boot summary with exactly the seven bounded counters.\\n backfill = null\\n if target == \\\"tinycloud_core::models::delegation_mode\\\" && level == \\\"info\\\" && length(f) == 8 {\\n backfill_code = get({\\\"delegation mode boot reindex complete\\\":\\\"delegation_mode_boot_reindex_complete\\\",\\\"delegation mode boot reindex incomplete; skipped rows remain unmarked and derive on read\\\":\\\"delegation_mode_boot_reindex_incomplete\\\",\\\"delegation mode boot reindex incomplete (lock timeout); remaining rows derive on read\\\":\\\"delegation_mode_boot_reindex_lock_timeout\\\"}, [msg]) ?? null\\n if is_string(backfill_code) {\\n counters = {}\\n for_each([\\\"scanned\\\", \\\"reindexed_terminal\\\", \\\"marked_attenuable\\\", \\\"marked_invalid\\\", \\\"skipped_locked_pages\\\", \\\"skipped_decrypt_failed\\\", \\\"elapsed_ms\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n counters = set!(counters, [field], value)\\n }\\n }\\n if length(counters) == 7 {\\n backfill = merge(counters, {\\\"event\\\": \\\"delegation_mode_boot_reindex\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"event_code\\\": backfill_code})\\n }\\n }\\n }\\n # TC-4177: the deletion ledger's one line per start (target `tinycloud`, info) ships as an individual event. Either the\\n # message plus exactly `event`, `ledger_file` (a declared state), five bounded integer counts and `newest_deleted_at`\\n # (`none` or an RFC 3339 instant: digits, `T`, `:`, `.`, `Z`, `+`, `-` only), or the failure message plus exactly\\n # `event` and an `error_kind` from the ledger's fixed kinds. The message is never copied. Anything else leaves\\n # ledger_start null and the info line is dropped below.\\n ledger_start = null\\n if target == \\\"tinycloud\\\" && level == \\\"info\\\" && (string(f.event) ?? \\\"\\\") == \\\"deletion_ledger_start\\\" {\\n if msg == \\\"deletion ledger at start\\\" && length(f) == 9 {\\n ls_file = string(f.ledger_file) ?? \\\"\\\"\\n ls_newest = string(f.newest_deleted_at) ?? \\\"\\\"\\n if includes([\\\"missing\\\",\\\"empty\\\",\\\"present\\\"], ls_file) && match(ls_newest, r'^(none|\\\\d{4}-\\\\d{2}-\\\\d{2}[Tt]\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d{1,9})?([Zz]|[+-]\\\\d{2}:\\\\d{2}))$') {\\n ls_counts = {}\\n for_each([\\\"bytes\\\",\\\"operations\\\",\\\"key_entries\\\",\\\"committed\\\",\\\"aborted\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n ls_counts = set!(ls_counts, [field], value)\\n }\\n }\\n if length(ls_counts) == 5 {\\n ledger_start = merge(ls_counts, {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"ledger_file\\\": ls_file, \\\"newest_deleted_at\\\": ls_newest})\\n }\\n }\\n } else if msg == \\\"deletion ledger counts unavailable at start\\\" && length(f) == 3 {\\n ls_kind = string(f.error_kind) ?? \\\"\\\"\\n if includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], ls_kind) {\\n ledger_start = {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"error_kind\\\": ls_kind}\\n }\\n }\\n }\\n # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired\\n # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error\\n # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one\\n # of the ledger's fixed kinds. The message is never copied. Anything else leaves ledger null and the line falls back\\n # to the unclassified count below.\\n ledger = null\\n l_event = string(f.event) ?? \\\"\\\"\\n if level == \\\"error\\\" && includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], l_event) && exists(f.message) && length(f) == 3 {\\n l_target = get({\\\"deletion_ledger_open_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_replay_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_unrepaired\\\":\\\"tinycloud_core::encryption_network::deletion_ledger\\\"}, [l_event]) ?? \\\"\\\"\\n l_kind = string(f.error_kind) ?? \\\"\\\"\\n if target == l_target && includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], l_kind) {\\n ledger = {\\\"event\\\": l_event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"error\\\", \\\"error_kind\\\": l_kind}\\n }\\n }\\n if target == \\\"tinycloud::request\\\" && level == \\\"info\\\" && msg == \\\"request\\\" {\\n method = string!(f.method)\\n if includes([\\\"TRACE\\\", \\\"CONNECT\\\"], method) { method = \\\"\\\" }\\n route = string!(f.route)\\n canonical_route = get(aliases, [route]) ?? null\\n if is_string(canonical_route) { route = canonical_route }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = f.status\\n latency = f.latency_us\\n if !is_integer(status) || !is_integer(latency) { abort }\\n status = int!(status)\\n latency = int!(latency)\\n if status < 100 || status > 599 || latency < 0 || latency > 9007199254740991 { abort }\\n out = {\\\"event\\\": \\\"node_request\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"latency_us\\\": latency}\\n # N2 correlation fields: copied only when they have exactly the node's emitted shape; anything else is dropped\\n # (the event still ships). The pseudonyms are keyed HMAC-SHA256 digests, never raw identifiers.\\n rid = string(f.request_id) ?? \\\"\\\"\\n if match(rid, r'^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') { out.request_id = rid }\\n replaced = f.request_id_replaced\\n if is_boolean(replaced) { out.request_id_replaced = replaced }\\n account = string(f.account_hash) ?? \\\"\\\"\\n if match(account, r'^[0-9a-f]{64}$') { out.account_hash = account }\\n space = string(f.space_hash) ?? \\\"\\\"\\n if match(space, r'^[0-9a-f]{64}$') { out.space_hash = space }\\n # TC-3834: the 5xx origin, on status 500 and above only, and only when it is exactly one of the declared codes;\\n # anything else is dropped (the event still ships). A closed vocabulary, never error text.\\n if status >= 500 {\\n error_code = string(f.error_code) ?? \\\"\\\"\\n if includes([\\\"db_error\\\",\\\"db_timeout\\\",\\\"db_busy\\\",\\\"req_timeout\\\",\\\"read_audit\\\",\\\"storage_io\\\",\\\"caveat_db\\\",\\\"read_tx_error\\\",\\\"key_ledger\\\",\\\"lifecycle\\\",\\\"registry_down\\\",\\\"cutover_fence\\\",\\\"kv_candidate\\\",\\\"engine_error\\\",\\\"encryption\\\",\\\"size_limit\\\",\\\"disk_headroom\\\",\\\"internal\\\"], error_code) { out.error_code = error_code }\\n }\\n # TC-3739: per-request DB accounting, on status below 400 only (4xx/5xx are the capped classes; DB-caused 5xx\\n # already carry elapsed_ms on db_failure_5xx). Copied only as plain numbers inside the canonical bounds; anything\\n # else is dropped (the event still ships). They are driver wall times and an attempt count, never identifiers.\\n if status < 400 {\\n pool_wait = f.pool_wait_ms\\n if is_float(pool_wait) || is_integer(pool_wait) {\\n pool_wait = to_float!(pool_wait)\\n if pool_wait >= 0.0 && pool_wait <= 86400000.0 { out.pool_wait_ms = pool_wait }\\n }\\n query_time = f.query_time_ms\\n if is_float(query_time) || is_integer(query_time) {\\n query_time = to_float!(query_time)\\n if query_time >= 0.0 && query_time <= 86400000.0 { out.query_time_ms = query_time }\\n }\\n query_count = f.query_count\\n if is_integer(query_count) {\\n query_count = int!(query_count)\\n if query_count >= 0 && query_count <= 9007199254740991 { out.query_count = query_count }\\n }\\n }\\n } else if is_object(db_event) {\\n out = db_event\\n } else if is_object(headroom) {\\n out = headroom\\n } else if is_object(backfill) {\\n out = backfill\\n } else if is_object(ledger_start) {\\n out = ledger_start\\n } else if is_object(ledger) {\\n out = ledger\\n } else {\\n if !includes([\\\"warn\\\", \\\"error\\\"], level) { abort }\\n code = \\\"unclassified\\\"\\n if target == \\\"tinycloud\\\" || starts_with(target, \\\"tinycloud::\\\") || target == \\\"tinycloud_core\\\" || starts_with(target, \\\"tinycloud_core::\\\") {\\n codes = {\\\"delegation mode boot backfill failed; unmarked rows derive on read\\\":\\\"delegation_mode_boot_backfill_failed\\\",\\\"delegation mode boot reindex skipped rows that failed decryption; leaving unmarked for read-time fail-closed handling\\\":\\\"delegation_mode_boot_reindex_decrypt_failed\\\",\\\"invocation replay insert failed\\\":\\\"invocation_replay_insert_failed\\\",\\\"invocation replay cleanup failed\\\":\\\"invocation_replay_cleanup_failed\\\",\\\"share-v2 local-tee feature active: deriving a deterministic, non-attested TEE identity from node key material\\\":\\\"share_local_tee_identity\\\",\\\"retention: delivered hook delivery prune failed\\\":\\\"retention_hook_delivery_prune_failed\\\",\\\"retention: dead-letter hook delivery prune failed\\\":\\\"retention_dead_letter_prune_failed\\\",\\\"retention: signed KV ticket prune failed\\\":\\\"retention_signed_ticket_prune_failed\\\",\\\"failed to load tunnel state; tunnel not started\\\":\\\"tunnel_state_load_failed\\\",\\\"invalid loopback API address; tunnel not started\\\":\\\"tunnel_address_invalid\\\",\\\"failed to load link state; LAN listener not started\\\":\\\"link_state_load_failed\\\",\\\"invalid link bind address; LAN listener not started\\\":\\\"link_bind_invalid\\\",\\\"invalid loopback API address; LAN listener not started\\\":\\\"link_address_invalid\\\",\\\"failed to bind link LAN listener; LAN listener not started\\\":\\\"link_bind_failed\\\",\\\"failed to build TLS config; LAN listener not started\\\":\\\"link_tls_config_failed\\\",\\\"link LAN listener exited with error\\\":\\\"link_listener_error\\\",\\\"failed to record link listener bind state\\\":\\\"link_listener_state_write_failed\\\",\\\"failed to record link listener bind failure\\\":\\\"link_bind_state_write_failed\\\",\\\"failed to load config for auto-renew\\\":\\\"link_auto_renew_config_failed\\\",\\\"link auto-renew failed\\\":\\\"link_auto_renew_failed\\\",\\\"failed to hot-reload renewed link cert\\\":\\\"link_cert_reload_failed\\\",\\\"link auto-renew succeeded but no state.json found; skipping cert hot-reload\\\":\\\"link_cert_state_missing\\\",\\\"failed to reload TLS material after link auto-renew\\\":\\\"link_listener_cert_reload_failed\\\",\\\"link disable: service delete failed; local state removed anyway\\\":\\\"link_disable_failed\\\",\\\"link connection error\\\":\\\"link_connection_error\\\",\\\"link listener accept error\\\":\\\"link_listener_accept_failed\\\",\\\"webhook delivery attempt failed\\\":\\\"webhook_delivery_failed\\\",\\\"webhook dispatcher loop failed\\\":\\\"webhook_dispatcher_failed\\\",\\\"addressed delegation authorization failed\\\":\\\"share_authorization_failed\\\",\\\"native share authorization denied\\\":\\\"share_native_authorization_denied\\\",\\\"native share KV put failed\\\":\\\"share_native_kv_put_failed\\\",\\\"share v2 readiness probe failed\\\":\\\"share_v2_readiness_failed\\\",\\\"share v2 is enabled but shareEmail.invitationPublicKey is unset\\\":\\\"share_invitation_key_missing\\\",\\\"configured share invitation key does not match the node's derived signing key\\\":\\\"share_invitation_key_mismatch\\\",\\\"share/v2 policy challenge denied\\\":\\\"share_policy_denied\\\",\\\"failed to read committed hook events\\\":\\\"hook_events_read_failed\\\",\\\"failed to load kv write hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"failed to load kv delete hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"missing committed kv hook row for invocation\\\":\\\"missing_committed_hook_row\\\",\\\"database write committed but webhook enqueue failed\\\":\\\"webhook_enqueue_failed\\\",\\\"tunnel: failed to prepare connection attempt\\\":\\\"tunnel_connection_prepare_failed\\\",\\\"tunnel: no frame within idle timeout; treating connection as dead\\\":\\\"tunnel_idle_timeout\\\",\\\"tunnel: read error\\\":\\\"tunnel_read_failed\\\",\\\"tunnel: dropping malformed frame\\\":\\\"tunnel_malformed_frame\\\",\\\"tunnel: relay sent an error frame\\\":\\\"tunnel_relay_error\\\",\\\"tunnel: failed to write frame\\\":\\\"tunnel_write_failed\\\",\\\"tunnel: failed to record runtime state\\\":\\\"tunnel_state_record_failed\\\",\\\"tunnel: failed to clear runtime state after disable\\\":\\\"tunnel_state_clear_failed\\\",\\\"tunnel authentication rejected\\\":\\\"tunnel_auth_rejected\\\",\\\"network DID resolution enabled: did:web/did:tz fetches use the unhardened ssi client (TC-1080)\\\":\\\"network_did_resolution_enabled\\\",\\\"SQL busy: lock wait\\\":\\\"sql_busy_lock_wait\\\",\\\"SQL busy: hydration\\\":\\\"sql_busy_hydration\\\",\\\"SQL busy: artifact transfer\\\":\\\"sql_busy_artifact_transfer\\\",\\\"Request deadline exceeded\\\":\\\"request_timeout\\\",\\\"Request completed after its deadline\\\":\\\"deadline_overrun\\\",\\\"Database hydration gave up loading its artifact\\\":\\\"sql_hydration_timeout\\\",\\\"Read audit wait expired\\\":\\\"read_audit_busy\\\",\\\"Read audit batch slow\\\":\\\"read_audit_batch_slow\\\",\\\"Read audit batch failed\\\":\\\"read_audit_batch_failed\\\",\\\"Read audit drain stalled\\\":\\\"read_audit_drain_stalled\\\",\\\"retrying operation after a lost database connection\\\":\\\"db_operation_retried\\\",\\\"not retrying operation: its first run took longer than the retry window to fail\\\":\\\"db_operation_retry_skipped_slow\\\",\\\"idx_current_kv_space_deleted_key_c is missing; the node keeps serving and KV list requests are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_current_kv_space_deleted_key_c)\\\":\\\"current_kv_c_index_missing\\\",\\\"idx_current_kv_space_deleted_key_c is invalid or still being built; the node keeps serving and KV list requests are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_invalid\\\",\\\"idx_current_kv_space_deleted_key_c exists with the wrong definition and is not used for KV lists; the node keeps serving and KV list requests are slower. Run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_wrong_shape\\\",\\\"idx_kv_write_space_value is missing; the node keeps serving and KV writes that attach a blob are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_kv_write_space_value)\\\":\\\"kv_write_value_index_missing\\\",\\\"idx_kv_write_space_value is invalid or still being built; the node keeps serving and KV writes that attach a blob are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_invalid\\\",\\\"idx_kv_write_space_value exists with the wrong definition and is not used for blob reference checks; the node keeps serving and KV writes that attach a blob are slower. Run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_wrong_shape\\\",\\\"request answered with a 5xx\\\":\\\"http_5xx\\\",\\\"chain guard wait exceeded the slow-wait threshold\\\":\\\"chain_guard_slow_wait\\\",\\\"kv head size probe failed; size omitted\\\":\\\"kv_head_size_probe_failed\\\",\\\"Database checkpoint save failed; refusing its writes until the back-off ends\\\":\\\"sql_checkpoint_save_backoff\\\",\\\"Database exceeds the artifact read limit; not loaded\\\":\\\"sql_database_too_large_to_load\\\",\\\"Database checkpoint exceeds the artifact write limit; not saved\\\":\\\"sql_checkpoint_too_large\\\",\\\"Database checkpoint shrank sharply against the artifact it replaces\\\":\\\"sql_checkpoint_shrank\\\",\\\"Database artifact storage unavailable\\\":\\\"sql_artifact_storage_unavailable\\\",\\\"Database artifact kept changing while it was read\\\":\\\"sql_artifact_changed_during_read\\\",\\\"Artifact part integrity check failed\\\":\\\"artifact_part_hash_mismatch\\\",\\\"Artifact part collection deferred\\\":\\\"artifact_part_collection_deferred\\\",\\\"Durable database artifact does not carry the expected file header; refusing to hydrate\\\":\\\"artifact_header_invalid\\\",\\\"No recorded artifact lineage for a live database; saving without a lineage assertion\\\":\\\"artifact_lineage_missing\\\",\\\"No recorded artifact lineage for a live database; discarding the actor\\\":\\\"artifact_lineage_missing_discarded\\\",\\\"Failed to open database\\\":\\\"database_open_failed\\\",\\\"Failed to promote database to file\\\":\\\"database_promote_failed\\\",\\\"Not enough free disk to promote a database; keeping it in memory\\\":\\\"database_promote_no_disk\\\",\\\"failed to copy view during table copy\\\":\\\"duckdb_view_copy_failed\\\",\\\"Database cache cleanup failed\\\":\\\"duckdb_cache_cleanup_failed\\\",\\\"sql ddl allowed without schema ability (ddl_requires_schema = log)\\\":\\\"sql_ddl_without_schema\\\",\\\"Local SQL commit failed\\\":\\\"sql_commit_failed\\\",\\\"Dead SQL actor detected, respawning\\\":\\\"sql_actor_respawned\\\",\\\"Dead SQL actor detected during export, removing\\\":\\\"sql_actor_dead_on_export\\\",\\\"sql_store shadow upload blocked for a database\\\":\\\"shadow_upload_blocked\\\",\\\"sql_store shadow could not read a manifest row\\\":\\\"shadow_manifest_read_failed\\\",\\\"sql_store shadow lag scan failed\\\":\\\"shadow_lag_scan_failed\\\",\\\"sql_store shadow drained behind PG\\\":\\\"shadow_drained_behind_pg\\\",\\\"database connection lost\\\":\\\"db_connection_lost\\\",\\\"retries suppressed after a database overload signal\\\":\\\"db_retries_suppressed\\\",\\\"not retrying operation: retries are suppressed after a database overload signal\\\":\\\"db_operation_retry_suppressed\\\",\\\"not retrying operation: the request deadline leaves no room\\\":\\\"db_operation_retry_no_deadline\\\",\\\"retry attempt stopped: the operation budget expired\\\":\\\"db_operation_retry_budget_spent\\\",\\\"Read audit batch timed out\\\":\\\"read_audit_batch_timeout\\\",\\\"failed to refund orphaned KV blob; periodic collector will retry\\\":\\\"kv_blob_refund_failed\\\",\\\"a deleting fence named a blob that a committed write references; it was closed without deleting the blob\\\":\\\"kv_blob_delete_skipped_referenced\\\",\\\"KV orphan collection failed\\\":\\\"kv_orphan_collection_failed\\\",\\\"delegate epoch path failed\\\":\\\"delegate_epoch_path_failed\\\",\\\"epoch insert failed\\\":\\\"epoch_insert_failed\\\",\\\"epoch head backfill stopped at its first error; writes stay correct and repair each space on its next write\\\":\\\"epoch_head_backfill_failed\\\",\\\"invocation referenced a space absent from the database\\\":\\\"invocation_space_missing\\\",\\\"deletion ledger is locked by another process: waiting for it\\\":\\\"deletion_ledger_lock_wait\\\",\\\"deletion ledger replayed at start\\\":\\\"deletion_ledger_replayed\\\",\\\"deletion ledger: committed line was not written\\\":\\\"deletion_ledger_commit_unwritten\\\",\\\"deletion ledger: could not tell whether a delete committed; the operation stays open\\\":\\\"deletion_ledger_commit_unknown\\\",\\\"deletion ledger: the settling line was not written\\\":\\\"deletion_ledger_settle_unwritten\\\",\\\"could not record losing network create ceremony as failed\\\":\\\"network_create_ceremony_mark_failed\\\",\\\"share scope validation failed\\\":\\\"share_scope_validation_failed\\\",\\\"delivery authorization refused\\\":\\\"delivery_authorization_refused\\\",\\\"delivery authorizations refused by the rate limit\\\":\\\"delivery_rate_limited\\\",\\\"deactivated webhook subscriptions; owners must re-register\\\":\\\"hook_subscriptions_deactivated\\\",\\\"webhook egress closed: internal endpoint refresh failed\\\":\\\"webhook_egress_refresh_failed\\\",\\\"webhook egress closed: internal endpoint lookup failed\\\":\\\"webhook_egress_lookup_failed\\\",\\\"webhook delivery mark refused: lease no longer held\\\":\\\"webhook_mark_lease_lost\\\",\\\"webhook delivery lease release failed\\\":\\\"webhook_lease_release_failed\\\",\\\"webhook delivery send skipped: lease no longer held\\\":\\\"webhook_send_lease_lost\\\",\\\"internal renewal scheduler pass failed\\\":\\\"renewal_scheduler_tick_failed\\\",\\\"renewals paused node-wide\\\":\\\"renewals_paused\\\",\\\"renewals resumed node-wide\\\":\\\"renewals_resumed\\\",\\\"the links API clock differs from the node clock\\\":\\\"links_read_clock_skew\\\",\\\"purge ledger reconciliation failed; space traffic stays refused\\\":\\\"space_purge_reconcile_failed\\\",\\\"space purge residue sweep failed\\\":\\\"space_purge_sweep_failed\\\",\\\"space purge phase failed; retrying later\\\":\\\"space_purge_phase_failed\\\",\\\"space purge attempt release failed\\\":\\\"space_purge_release_failed\\\",\\\"space purge claim failed\\\":\\\"space_purge_claim_failed\\\",\\\"owner erasure pass failed; retrying later\\\":\\\"owner_erasure_pass_failed\\\",\\\"skipped invalid space directories while measuring storage\\\":\\\"storage_invalid_space_dirs\\\",\\\"removed setting is set and ignored; delete it from the configuration\\\":\\\"removed_setting_ignored\\\",\\\"admin stats result exceeds its bound\\\":\\\"admin_stats_over_bound\\\",\\\"admin stats query failed\\\":\\\"admin_stats_query_failed\\\",\\\"TDX quote unavailable\\\":\\\"attestation_quote_unavailable\\\",\\\"dstack guest agent returned an error\\\":\\\"dstack_guest_agent_error\\\",\\\"tunnel: failed to build upstream HTTP client\\\":\\\"tunnel_upstream_client_failed\\\"}\\n known = get(codes, [msg]) ?? null\\n if is_string(known) { code = known }\\n if starts_with(msg, \\\"quota service returned \\\") { code = \\\"quota_fallback\\\" }\\nif starts_with(msg, \\\"Failed to get TDX quote: \\\") { code = \\\"attestation_quote_failed\\\" }\\nif starts_with(msg, \\\"created a new node identity at \\\") { code = \\\"node_identity_created\\\" }\\nif starts_with(msg, \\\"quota service returned an invalid body: \\\") { code = \\\"quota_invalid_body\\\" }\\nif starts_with(msg, \\\"dstack socket available but get_info failed: \\\") { code = \\\"dstack_get_info_failed\\\" }\\n # TC-3284: a line with no message is named by its constant `event` field, only when that event is listed.\\n if msg == \\\"\\\" && !exists(f.message) {\\n events = {\\\"did_resolution_refused\\\":\\\"did_resolution_refused\\\",\\\"renewal_scheduler_lease_failed\\\":\\\"renewal_scheduler_lease_failed\\\",\\\"session_retire_failed\\\":\\\"session_retire_failed\\\"}\\n named = get(events, [string(f.event) ?? \\\"\\\"]) ?? null\\n if is_string(named) { code = named }\\n }\\n }\\n if level == \\\"warn\\\" && target == \\\"rocket::config::config\\\" && msg == \\\"found value for deprecated config key `log`\\\" { code = \\\"rocket_deprecated_log_config\\\" }\\nif level == \\\"warn\\\" && target == \\\"rocket::launch\\\" && starts_with(msg, \\\"Rocket has launched from \\\") { code = \\\"rocket_launched\\\" }\\n event = if level == \\\"warn\\\" { \\\"node_warning\\\" } else { \\\"node_error\\\" }\\n out = {\\\"event\\\": event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": level, \\\"event_code\\\": code, \\\"event_count\\\": 1}\\n }\\n} else {\\n ts = string!(j.time)\\n method = string!(j.method)\\n route = string!(j.route)\\n if route == \\\"\\\" { route = \\\"\\\" }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = j.status\\n request_time = j.request_time\\n if !is_integer(status) || !(is_integer(request_time) || is_float(request_time)) { abort }\\n status = int!(status)\\n request_time = to_float!(request_time)\\n if status < 100 || status > 599 || request_time < 0 || request_time > 86400 { abort }\\n out = {\\\"event\\\": \\\"ingress_request\\\", \\\"svc\\\": \\\"ingress\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"request_time_seconds\\\": request_time}\\n}\\nif length(ts) > 64 { abort }\\nparsed_ts = parse_timestamp!(ts, format: \\\"%+\\\")\\nout.ts = format_timestamp!(parsed_ts, format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\")\\n. = out\\n\",\"drop_on_error\":true,\"drop_on_abort\":true,\"reroute_dropped\":true},\"gate_counts\":{\"type\":\"remap\",\"inputs\":[\"gate_route.rejected\",\"gate_route._unmatched\",\"allowlist.dropped\",\"event_route._unmatched\"],\"source\":\"reason = .reason\\nif !includes([\\\"malformed_envelope\\\",\\\"unexpected_label\\\",\\\"unlabelled\\\",\\\"non_json\\\",\\\"oversized\\\",\\\"partial\\\",\\\"invalid_fields\\\",\\\"unknown_target\\\",\\\"filtered_level\\\"], reason) { reason = \\\"invalid_fields\\\" }\\n. = {\\\"reason\\\": reason, \\\"count\\\": 1}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_reduce\":{\"type\":\"reduce\",\"inputs\":[\"gate_counts\"],\"group_by\":[\"reason\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"count\":\"sum\"}},\"gate_output\":{\"type\":\"remap\",\"inputs\":[\"gate_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": \\\"warn\\\", \\\"event\\\": \\\"logship_gate_summary_total\\\", \\\"svc\\\": \\\"logship\\\", \\\"reason\\\": .reason, \\\"count\\\": .count}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"request_profile\":{\"type\":\"filter\",\"inputs\":[\"allowlist\"],\"condition\":\"\\\"$${TINYCLOUD_LOGSHIP_PROFILE}\\\" == \\\"all_requests\\\" || includes([\\\"node_warning\\\",\\\"node_error\\\",\\\"node_storage_headroom\\\",\\\"delegation_mode_boot_reindex\\\",\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\",\\\"deletion_ledger_start\\\"], .event) || (int(.status) ?? 0) >= 400 || (.event == \\\"node_request\\\" && (int(.latency_us) ?? 0) > 1000000) || (.event == \\\"ingress_request\\\" && (to_float(.request_time_seconds) ?? 0.0) > 1.000000)\"},\"event_route\":{\"type\":\"route\",\"inputs\":[\"request_profile\"],\"route\":{\"request\":\"(.event == \\\"node_request\\\" || .event == \\\"ingress_request\\\") && !(((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)) && !((int(.status) ?? 0) >= 500)\",\"node_request_5xx\":\".event == \\\"node_request\\\" && (int(.status) ?? 0) >= 500\",\"ingress_request_5xx\":\".event == \\\"ingress_request\\\" && (int(.status) ?? 0) >= 500\",\"node_request_4xx\":\".event == \\\"node_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"ingress_request_4xx\":\".event == \\\"ingress_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"db_failure_5xx\":\".event == \\\"node_warning\\\" && .event_code == \\\"db_failure_5xx\\\"\",\"storage_headroom\":\".event == \\\"node_storage_headroom\\\"\",\"delegation_mode_boot_reindex\":\".event == \\\"delegation_mode_boot_reindex\\\"\",\"deletion_ledger\":\"includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event)\",\"deletion_ledger_start\":\".event == \\\"deletion_ledger_start\\\"\",\"diagnostic\":\"(.event == \\\"node_warning\\\" && .event_code != \\\"db_failure_5xx\\\") || .event == \\\"node_error\\\"\"}},\"cap_db_failure_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.db_failure_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"db_failure_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"diagnostic_reduce\":{\"type\":\"reduce\",\"inputs\":[\"event_route.diagnostic\"],\"group_by\":[\"event\",\"event_code\",\"level\",\"svc\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"event_count\":\"sum\",\"ts\":\"discard\"}},\"diagnostic_output\":{\"type\":\"remap\",\"inputs\":[\"diagnostic_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": .level, \\\"event\\\": .event, \\\"svc\\\": \\\"api\\\", \\\"event_code\\\": .event_code, \\\"event_count\\\": .event_count}\",\"drop_on_error\":true,\"drop_on_abort\":true}},\"sinks\":{\"betterstack\":{\"type\":\"http\",\"inputs\":[\"event_route.request\",\"event_route.storage_headroom\",\"event_route.delegation_mode_boot_reindex\",\"event_route.deletion_ledger\",\"event_route.deletion_ledger_start\",\"cap_db_failure_5xx\",\"cap_node_request_5xx\",\"cap_ingress_request_5xx\",\"cap_node_request_4xx\",\"cap_ingress_request_4xx\",\"diagnostic_output\",\"gate_output\"],\"method\":\"post\",\"uri\":\"https://s2795437.us-west-2a.betterstackdata.com/\",\"encoding\":{\"codec\":\"json\"},\"framing\":{\"method\":\"newline_delimited\"},\"compression\":\"gzip\",\"auth\":{\"strategy\":\"bearer\",\"token\":\"SECRET[bs.bs_token]\"},\"batch\":{\"max_bytes\":262144,\"timeout_secs\":1},\"buffer\":{\"type\":\"memory\",\"max_events\":1000,\"when_full\":\"block\"},\"request\":{\"timeout_secs\":10,\"retry_max_duration_secs\":300},\"healthcheck\":{\"enabled\":false}}},\"secret\":{\"bs\":{\"type\":\"directory\",\"path\":\"/var/lib/vector/secrets\",\"remove_trailing_whitespace\":true}}}" + VECTOR_CONFIG_JSON: "{\"data_dir\":\"/var/lib/vector\",\"sources\":{\"gelf_in\":{\"type\":\"socket\",\"mode\":\"udp\",\"address\":\"0.0.0.0:12201\",\"max_length\":262144,\"receive_buffer_bytes\":8388608,\"framing\":{\"method\":\"chunked_gelf\",\"chunked_gelf\":{\"decompression\":\"Auto\"}},\"decoding\":{\"codec\":\"bytes\"}}},\"transforms\":{\"gelf_envelope\":{\"type\":\"remap\",\"inputs\":[\"gelf_in\"],\"source\":\"packet = string(.message) ?? \\\"\\\"\\nif length(packet) > 262144 {\\n . = {\\\"reason\\\": \\\"oversized\\\"}\\n} else {\\n outer, err = parse_json(packet)\\n if err != null || !is_object(outer) || (outer.version != \\\"1.1\\\" && outer.version != \\\"1.0\\\") {\\n . = {\\\"reason\\\": \\\"malformed_envelope\\\"}\\n } else if exists(outer.partial_message) || exists(outer._partial_message) {\\n . = {\\\"reason\\\": \\\"partial\\\"}\\n } else {\\n label = get(outer, [\\\"_tc.logship\\\"]) ?? null\\n . = {\\\"_tc.logship\\\": label, \\\"message\\\": outer.short_message}\\n }\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"logship_gate\":{\"type\":\"remap\",\"inputs\":[\"gelf_envelope\"],\"source\":\"if exists(.reason) {\\n . = {\\\"reason\\\": .reason}\\n} else {\\nlabel = string(get(., [\\\"_tc.logship\\\"]) ?? null) ?? \\\"\\\"\\nraw = .message\\nreason = \\\"\\\"\\nif label == \\\"\\\" { reason = \\\"unlabelled\\\" }\\nelse if !includes([\\\"tinycloud-node\\\", \\\"tinycloud-ingress\\\"], label) { reason = \\\"unexpected_label\\\" }\\nelse if exists(.partial_message) { reason = \\\"partial\\\" }\\nelse if !is_string(raw) { reason = \\\"malformed_envelope\\\" }\\nelse if length(string!(raw)) > 65536 { reason = \\\"oversized\\\" }\\nif reason != \\\"\\\" {\\n . = {\\\"reason\\\": reason}\\n} else {\\n parsed, err = parse_json(string!(raw))\\n if err != null || !is_object(parsed) { . = {\\\"reason\\\": \\\"non_json\\\"} }\\n else if exists(parsed.partial_message) { . = {\\\"reason\\\": \\\"partial\\\"} }\\n else {\\n target = string(parsed.target) ?? \\\"\\\"\\n level = downcase(string(parsed.level) ?? \\\"\\\")\\n gate_fields = object(parsed.fields) ?? {}\\n gate_event = string(gate_fields.event) ?? \\\"\\\"\\n if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && target != \\\"tinycloud\\\" && !starts_with(target, \\\"tinycloud::\\\") && target != \\\"tinycloud_core\\\" && !starts_with(target, \\\"tinycloud_core::\\\") {\\n . = {\\\"reason\\\": \\\"unknown_target\\\"}\\n } else if label == \\\"tinycloud-node\\\" && !includes([\\\"warn\\\", \\\"error\\\"], level) && !((target == \\\"tinycloud::request\\\" || target == \\\"tinycloud::disk_headroom\\\" || target == \\\"tinycloud_core::models::delegation_mode\\\" || (target == \\\"tinycloud\\\" && gate_event == \\\"deletion_ledger_start\\\")) && level == \\\"info\\\") {\\n . = {\\\"reason\\\": \\\"filtered_level\\\"}\\n } else { . = {\\\"label\\\": label, \\\"parsed\\\": parsed} }\\n }\\n}\\n}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_route\":{\"type\":\"route\",\"inputs\":[\"logship_gate\"],\"route\":{\"candidate\":\"exists(.parsed)\",\"rejected\":\"exists(.reason)\"}},\"allowlist\":{\"type\":\"remap\",\"inputs\":[\"gate_route.candidate\"],\"source\":\"# Only this fresh object can leave the process boundary. No envelope, span,\\n# message, error, identity, URI or unknown key is copied into it.\\nj = .parsed\\nlabel = .label\\nout = {}\\nts = \\\"\\\"\\nif label == \\\"tinycloud-node\\\" {\\n target = string(j.target) ?? \\\"\\\"\\n level = downcase(string!(j.level))\\n f = object(j.fields) ?? {}\\n msg = string(f.message) ?? \\\"\\\"\\n ts = string!(j.timestamp)\\n # Literal Rocket template aliases only; never split an arbitrary URI.\\n aliases = {\\\"/attestation?\\\":\\\"/attestation\\\",\\\"/.well-known/encryption/network/?\\\":\\\"/.well-known/encryption/network/\\\",\\\"/hooks/events?\\\":\\\"/hooks/events\\\",\\\"/hooks/webhooks?\\\":\\\"/hooks/webhooks\\\",\\\"/public//kv?\\\":\\\"/public//kv\\\"}\\n # TC-1840: the node's one 5xx diagnostic line per database failure ships as an individual event.\\n # The input must carry exactly the declared keys (the message plus these seven, and db_hash only\\n # when it is a valid pseudonym) with exactly the declared types and enum values. Anything else\\n # leaves db_event null and the line falls back to the unclassified count below; no value of it\\n # is ever copied unless it passed, and the shipped object is built from literals and the\\n # validated values only.\\n db_event = null\\n if target == \\\"tinycloud::request\\\" && level == \\\"warn\\\" && msg == \\\"database failure answered with a 5xx\\\" {\\n db_status = f.status\\n db_elapsed = f.elapsed_ms\\n db_code = string(f.code) ?? \\\"\\\"\\n db_service = string(f.service) ?? \\\"\\\"\\n db_kind = string(f.failure_kind) ?? \\\"\\\"\\n db_route = string(f.route) ?? \\\"\\\"\\n db_canonical_route = get(aliases, [db_route]) ?? null\\n if is_string(db_canonical_route) { db_route = db_canonical_route }\\n db_ok = is_integer(db_status) && is_integer(db_elapsed) && is_boolean(f.write_may_have_applied)\\n if db_ok {\\n db_status = int!(db_status)\\n db_elapsed = int!(db_elapsed)\\n db_ok = db_status >= 500 && db_status <= 599 && db_elapsed >= 0 && db_elapsed <= 9007199254740991 && includes([\\\"unavailable_retryable\\\",\\\"outcome_unknown\\\",\\\"internal\\\",\\\"sql_busy\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\"], db_code) && includes([\\\"sql\\\",\\\"duckdb\\\",\\\"kv\\\",\\\"other\\\"], db_service) && includes([\\\"pool_timeout\\\",\\\"pool_closed\\\",\\\"io\\\",\\\"statement_timeout\\\",\\\"serialization\\\",\\\"connection_lost\\\",\\\"artifact_changed\\\",\\\"lock_wait\\\",\\\"hydration\\\",\\\"artifact_transfer\\\",\\\"request_timeout\\\",\\\"read_audit_busy\\\",\\\"other\\\"], db_kind) && includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], db_route)\\n }\\n db_hash = string(f.db_hash) ?? \\\"\\\"\\n has_db_hash = exists(f.db_hash)\\n if db_ok {\\n if has_db_hash { db_ok = match(db_hash, r'^[0-9a-f]{64}$') && length(f) == 9 } else { db_ok = length(f) == 8 }\\n }\\n if db_ok {\\n db_event = {\\\"event\\\": \\\"node_warning\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"warn\\\", \\\"event_code\\\": \\\"db_failure_5xx\\\", \\\"status\\\": db_status, \\\"code\\\": db_code, \\\"service\\\": db_service, \\\"route\\\": db_route, \\\"elapsed_ms\\\": db_elapsed, \\\"failure_kind\\\": db_kind, \\\"write_may_have_applied\\\": bool!(f.write_may_have_applied)}\\n if has_db_hash { db_event.db_hash = db_hash }\\n }\\n }\\n # TC-2917: the node's periodic disk headroom line (one per local store) ships as an individual\\n # info event. Exactly the message plus `store` (a declared store) and `free_bytes` (a bounded\\n # integer in whole 64 MiB steps, as the node rounds it); anything else leaves headroom null, and\\n # the info line is then dropped below.\\n headroom = null\\n if target == \\\"tinycloud::disk_headroom\\\" && level == \\\"info\\\" && msg == \\\"storage headroom\\\" && length(f) == 3 {\\n h_store = string(f.store) ?? \\\"\\\"\\n h_free = f.free_bytes\\n if includes([\\\"sql\\\",\\\"duckdb\\\"], h_store) && is_integer(h_free) {\\n h_free = int!(h_free)\\n if h_free >= 0 && h_free <= 9007199254740991 && mod(h_free, 67108864) == 0 {\\n headroom = {\\\"event\\\": \\\"node_storage_headroom\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"store\\\": h_store, \\\"free_bytes\\\": h_free}\\n }\\n }\\n }\\n # TC-3973: ship the boot summary with exactly the seven bounded counters.\\n backfill = null\\n if target == \\\"tinycloud_core::models::delegation_mode\\\" && level == \\\"info\\\" && length(f) == 8 {\\n backfill_code = get({\\\"delegation mode boot reindex complete\\\":\\\"delegation_mode_boot_reindex_complete\\\",\\\"delegation mode boot reindex incomplete; skipped rows remain unmarked and derive on read\\\":\\\"delegation_mode_boot_reindex_incomplete\\\",\\\"delegation mode boot reindex incomplete (lock timeout); remaining rows derive on read\\\":\\\"delegation_mode_boot_reindex_lock_timeout\\\"}, [msg]) ?? null\\n if is_string(backfill_code) {\\n counters = {}\\n for_each([\\\"scanned\\\", \\\"reindexed_terminal\\\", \\\"marked_attenuable\\\", \\\"marked_invalid\\\", \\\"skipped_locked_pages\\\", \\\"skipped_decrypt_failed\\\", \\\"elapsed_ms\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n counters = set!(counters, [field], value)\\n }\\n }\\n if length(counters) == 7 {\\n backfill = merge(counters, {\\\"event\\\": \\\"delegation_mode_boot_reindex\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"event_code\\\": backfill_code})\\n }\\n }\\n }\\n # TC-4177: the deletion ledger's one line per start (target `tinycloud`, info) ships as an individual event. Either the\\n # message plus exactly `event`, `ledger_file` (a declared state), five bounded integer counts and `newest_deleted_at`\\n # (`none` or an RFC 3339 instant: digits, `T`, `:`, `.`, `Z`, `+`, `-` only), or the failure message plus exactly\\n # `event` and an `error_kind` from the ledger's fixed kinds. The message is never copied. Anything else leaves\\n # ledger_start null and the info line is dropped below.\\n ledger_start = null\\n if target == \\\"tinycloud\\\" && level == \\\"info\\\" && (string(f.event) ?? \\\"\\\") == \\\"deletion_ledger_start\\\" {\\n if msg == \\\"deletion ledger at start\\\" && length(f) == 9 {\\n ls_file = string(f.ledger_file) ?? \\\"\\\"\\n ls_newest = string(f.newest_deleted_at) ?? \\\"\\\"\\n if includes([\\\"missing\\\",\\\"empty\\\",\\\"present\\\"], ls_file) && match(ls_newest, r'^(none|\\\\d{4}-\\\\d{2}-\\\\d{2}[Tt]\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d{1,9})?([Zz]|[+-]\\\\d{2}:\\\\d{2}))$') {\\n ls_counts = {}\\n for_each([\\\"bytes\\\",\\\"operations\\\",\\\"key_entries\\\",\\\"committed\\\",\\\"aborted\\\"]) -> |_index, field| {\\n value = int(get(f, [field]) ?? null) ?? -1\\n if value >= 0 && value <= 9007199254740991 {\\n ls_counts = set!(ls_counts, [field], value)\\n }\\n }\\n if length(ls_counts) == 5 {\\n ledger_start = merge(ls_counts, {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"ledger_file\\\": ls_file, \\\"newest_deleted_at\\\": ls_newest})\\n }\\n }\\n } else if msg == \\\"deletion ledger counts unavailable at start\\\" && length(f) == 3 {\\n ls_kind = string(f.error_kind) ?? \\\"\\\"\\n if includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], ls_kind) {\\n ledger_start = {\\\"event\\\": \\\"deletion_ledger_start\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"error_kind\\\": ls_kind}\\n }\\n }\\n }\\n # TC-3284: the deletion ledger's three error events (open and replay at start from target `tinycloud`, an unrepaired\\n # append from the ledger module) ship individually as their event name and `error_kind`. The input must be an error\\n # from that event's own target with exactly the message, `event` and `error_kind` keys, and `error_kind` exactly one\\n # of the ledger's fixed kinds. The message is never copied. Anything else leaves ledger null and the line falls back\\n # to the unclassified count below.\\n ledger = null\\n l_event = string(f.event) ?? \\\"\\\"\\n if level == \\\"error\\\" && includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], l_event) && exists(f.message) && length(f) == 3 {\\n l_target = get({\\\"deletion_ledger_open_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_replay_failed\\\":\\\"tinycloud\\\",\\\"deletion_ledger_unrepaired\\\":\\\"tinycloud_core::encryption_network::deletion_ledger\\\"}, [l_event]) ?? \\\"\\\"\\n l_kind = string(f.error_kind) ?? \\\"\\\"\\n if target == l_target && includes([\\\"io\\\",\\\"path\\\",\\\"encode\\\",\\\"moved\\\",\\\"lock_held\\\",\\\"malformed\\\",\\\"refused\\\",\\\"db\\\"], l_kind) {\\n ledger = {\\\"event\\\": l_event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"error\\\", \\\"error_kind\\\": l_kind}\\n }\\n }\\n if target == \\\"tinycloud::request\\\" && level == \\\"info\\\" && msg == \\\"request\\\" {\\n method = string!(f.method)\\n if includes([\\\"TRACE\\\", \\\"CONNECT\\\"], method) { method = \\\"\\\" }\\n route = string!(f.route)\\n canonical_route = get(aliases, [route]) ?? null\\n if is_string(canonical_route) { route = canonical_route }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = f.status\\n latency = f.latency_us\\n if !is_integer(status) || !is_integer(latency) { abort }\\n status = int!(status)\\n latency = int!(latency)\\n if status < 100 || status > 599 || latency < 0 || latency > 9007199254740991 { abort }\\n out = {\\\"event\\\": \\\"node_request\\\", \\\"svc\\\": \\\"api\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"latency_us\\\": latency}\\n # N2 correlation fields: copied only when they have exactly the node's emitted shape; anything else is dropped\\n # (the event still ships). The pseudonyms are keyed HMAC-SHA256 digests, never raw identifiers.\\n rid = string(f.request_id) ?? \\\"\\\"\\n if match(rid, r'^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$') { out.request_id = rid }\\n replaced = f.request_id_replaced\\n if is_boolean(replaced) { out.request_id_replaced = replaced }\\n account = string(f.account_hash) ?? \\\"\\\"\\n if match(account, r'^[0-9a-f]{64}$') { out.account_hash = account }\\n space = string(f.space_hash) ?? \\\"\\\"\\n if match(space, r'^[0-9a-f]{64}$') { out.space_hash = space }\\n # TC-3834: the 5xx origin, on status 500 and above only, and only when it is exactly one of the declared codes;\\n # anything else is dropped (the event still ships). A closed vocabulary, never error text.\\n if status >= 500 {\\n error_code = string(f.error_code) ?? \\\"\\\"\\n if includes([\\\"db_error\\\",\\\"db_timeout\\\",\\\"db_busy\\\",\\\"req_timeout\\\",\\\"read_audit\\\",\\\"storage_io\\\",\\\"caveat_db\\\",\\\"read_tx_error\\\",\\\"key_ledger\\\",\\\"lifecycle\\\",\\\"registry_down\\\",\\\"cutover_fence\\\",\\\"kv_candidate\\\",\\\"engine_error\\\",\\\"encryption\\\",\\\"size_limit\\\",\\\"disk_headroom\\\",\\\"internal\\\"], error_code) { out.error_code = error_code }\\n }\\n # TC-3739: per-request DB accounting, on status below 400 only (4xx/5xx are the capped classes; DB-caused 5xx\\n # already carry elapsed_ms on db_failure_5xx). Copied only as plain numbers inside the canonical bounds; anything\\n # else is dropped (the event still ships). They are driver wall times and an attempt count, never identifiers.\\n if status < 400 {\\n pool_wait = f.pool_wait_ms\\n if is_float(pool_wait) || is_integer(pool_wait) {\\n pool_wait = to_float!(pool_wait)\\n if pool_wait >= 0.0 && pool_wait <= 86400000.0 { out.pool_wait_ms = pool_wait }\\n }\\n query_time = f.query_time_ms\\n if is_float(query_time) || is_integer(query_time) {\\n query_time = to_float!(query_time)\\n if query_time >= 0.0 && query_time <= 86400000.0 { out.query_time_ms = query_time }\\n }\\n query_count = f.query_count\\n if is_integer(query_count) {\\n query_count = int!(query_count)\\n if query_count >= 0 && query_count <= 9007199254740991 { out.query_count = query_count }\\n }\\n }\\n } else if is_object(db_event) {\\n out = db_event\\n } else if is_object(headroom) {\\n out = headroom\\n } else if is_object(backfill) {\\n out = backfill\\n } else if is_object(ledger_start) {\\n out = ledger_start\\n } else if is_object(ledger) {\\n out = ledger\\n } else {\\n if !includes([\\\"warn\\\", \\\"error\\\"], level) { abort }\\n code = \\\"unclassified\\\"\\n if target == \\\"tinycloud\\\" || starts_with(target, \\\"tinycloud::\\\") || target == \\\"tinycloud_core\\\" || starts_with(target, \\\"tinycloud_core::\\\") {\\n codes = {\\\"delegation mode boot backfill failed; unmarked rows derive on read\\\":\\\"delegation_mode_boot_backfill_failed\\\",\\\"delegation mode boot reindex skipped rows that failed decryption; leaving unmarked for read-time fail-closed handling\\\":\\\"delegation_mode_boot_reindex_decrypt_failed\\\",\\\"invocation replay insert failed\\\":\\\"invocation_replay_insert_failed\\\",\\\"invocation replay cleanup failed\\\":\\\"invocation_replay_cleanup_failed\\\",\\\"share-v2 local-tee feature active: deriving a deterministic, non-attested TEE identity from node key material\\\":\\\"share_local_tee_identity\\\",\\\"retention: delivered hook delivery prune failed\\\":\\\"retention_hook_delivery_prune_failed\\\",\\\"retention: dead-letter hook delivery prune failed\\\":\\\"retention_dead_letter_prune_failed\\\",\\\"retention: signed KV ticket prune failed\\\":\\\"retention_signed_ticket_prune_failed\\\",\\\"failed to load tunnel state; tunnel not started\\\":\\\"tunnel_state_load_failed\\\",\\\"invalid loopback API address; tunnel not started\\\":\\\"tunnel_address_invalid\\\",\\\"failed to load link state; LAN listener not started\\\":\\\"link_state_load_failed\\\",\\\"invalid link bind address; LAN listener not started\\\":\\\"link_bind_invalid\\\",\\\"invalid loopback API address; LAN listener not started\\\":\\\"link_address_invalid\\\",\\\"failed to bind link LAN listener; LAN listener not started\\\":\\\"link_bind_failed\\\",\\\"failed to build TLS config; LAN listener not started\\\":\\\"link_tls_config_failed\\\",\\\"link LAN listener exited with error\\\":\\\"link_listener_error\\\",\\\"failed to record link listener bind state\\\":\\\"link_listener_state_write_failed\\\",\\\"failed to record link listener bind failure\\\":\\\"link_bind_state_write_failed\\\",\\\"failed to load config for auto-renew\\\":\\\"link_auto_renew_config_failed\\\",\\\"link auto-renew failed\\\":\\\"link_auto_renew_failed\\\",\\\"failed to hot-reload renewed link cert\\\":\\\"link_cert_reload_failed\\\",\\\"link auto-renew succeeded but no state.json found; skipping cert hot-reload\\\":\\\"link_cert_state_missing\\\",\\\"failed to reload TLS material after link auto-renew\\\":\\\"link_listener_cert_reload_failed\\\",\\\"link disable: service delete failed; local state removed anyway\\\":\\\"link_disable_failed\\\",\\\"link connection error\\\":\\\"link_connection_error\\\",\\\"link listener accept error\\\":\\\"link_listener_accept_failed\\\",\\\"webhook delivery attempt failed\\\":\\\"webhook_delivery_failed\\\",\\\"webhook dispatcher loop failed\\\":\\\"webhook_dispatcher_failed\\\",\\\"addressed delegation authorization failed\\\":\\\"share_authorization_failed\\\",\\\"native share authorization denied\\\":\\\"share_native_authorization_denied\\\",\\\"native share KV put failed\\\":\\\"share_native_kv_put_failed\\\",\\\"share v2 readiness probe failed\\\":\\\"share_v2_readiness_failed\\\",\\\"share v2 is enabled but shareEmail.invitationPublicKey is unset\\\":\\\"share_invitation_key_missing\\\",\\\"configured share invitation key does not match the node's derived signing key\\\":\\\"share_invitation_key_mismatch\\\",\\\"share/v2 policy challenge denied\\\":\\\"share_policy_denied\\\",\\\"failed to read committed hook events\\\":\\\"hook_events_read_failed\\\",\\\"failed to load kv write hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"failed to load kv delete hook rows\\\":\\\"hook_rows_load_failed\\\",\\\"missing committed kv hook row for invocation\\\":\\\"missing_committed_hook_row\\\",\\\"database write committed but webhook enqueue failed\\\":\\\"webhook_enqueue_failed\\\",\\\"tunnel: failed to prepare connection attempt\\\":\\\"tunnel_connection_prepare_failed\\\",\\\"tunnel: no frame within idle timeout; treating connection as dead\\\":\\\"tunnel_idle_timeout\\\",\\\"tunnel: read error\\\":\\\"tunnel_read_failed\\\",\\\"tunnel: dropping malformed frame\\\":\\\"tunnel_malformed_frame\\\",\\\"tunnel: relay sent an error frame\\\":\\\"tunnel_relay_error\\\",\\\"tunnel: failed to write frame\\\":\\\"tunnel_write_failed\\\",\\\"tunnel: failed to record runtime state\\\":\\\"tunnel_state_record_failed\\\",\\\"tunnel: failed to clear runtime state after disable\\\":\\\"tunnel_state_clear_failed\\\",\\\"tunnel authentication rejected\\\":\\\"tunnel_auth_rejected\\\",\\\"network DID resolution enabled: did:web/did:tz fetches use the unhardened ssi client (TC-1080)\\\":\\\"network_did_resolution_enabled\\\",\\\"SQL busy: lock wait\\\":\\\"sql_busy_lock_wait\\\",\\\"SQL busy: hydration\\\":\\\"sql_busy_hydration\\\",\\\"SQL busy: artifact transfer\\\":\\\"sql_busy_artifact_transfer\\\",\\\"Request deadline exceeded\\\":\\\"request_timeout\\\",\\\"Request completed after its deadline\\\":\\\"deadline_overrun\\\",\\\"Database hydration gave up loading its artifact\\\":\\\"sql_hydration_timeout\\\",\\\"Read audit wait expired\\\":\\\"read_audit_busy\\\",\\\"Read audit batch slow\\\":\\\"read_audit_batch_slow\\\",\\\"Read audit batch failed\\\":\\\"read_audit_batch_failed\\\",\\\"Read audit drain stalled\\\":\\\"read_audit_drain_stalled\\\",\\\"retrying operation after a lost database connection\\\":\\\"db_operation_retried\\\",\\\"not retrying operation: its first run took longer than the retry window to fail\\\":\\\"db_operation_retry_skipped_slow\\\",\\\"idx_current_kv_space_deleted_key_c is missing; the node keeps serving and KV list requests are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_current_kv_space_deleted_key_c)\\\":\\\"current_kv_c_index_missing\\\",\\\"idx_current_kv_space_deleted_key_c is invalid or still being built; the node keeps serving and KV list requests are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_invalid\\\",\\\"idx_current_kv_space_deleted_key_c exists with the wrong definition and is not used for KV lists; the node keeps serving and KV list requests are slower. Run DROP INDEX CONCURRENTLY idx_current_kv_space_deleted_key_c; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_current_kv_space_deleted_key_c\\\":\\\"current_kv_c_index_wrong_shape\\\",\\\"idx_kv_write_space_value is missing; the node keeps serving and KV writes that attach a blob are slower until an operator builds it with CREATE INDEX CONCURRENTLY (docs/releasing.md, section idx_kv_write_space_value)\\\":\\\"kv_write_value_index_missing\\\",\\\"idx_kv_write_space_value is invalid or still being built; the node keeps serving and KV writes that attach a blob are slower. If no CREATE INDEX CONCURRENTLY is running, run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_invalid\\\",\\\"idx_kv_write_space_value exists with the wrong definition and is not used for blob reference checks; the node keeps serving and KV writes that attach a blob are slower. Run DROP INDEX CONCURRENTLY idx_kv_write_space_value; and then the CREATE INDEX CONCURRENTLY in docs/releasing.md, section idx_kv_write_space_value\\\":\\\"kv_write_value_index_wrong_shape\\\",\\\"request answered with a 5xx\\\":\\\"http_5xx\\\",\\\"chain guard wait exceeded the slow-wait threshold\\\":\\\"chain_guard_slow_wait\\\",\\\"kv head size probe failed; size omitted\\\":\\\"kv_head_size_probe_failed\\\",\\\"Database checkpoint save failed; refusing its writes until the back-off ends\\\":\\\"sql_checkpoint_save_backoff\\\",\\\"Database exceeds the artifact read limit; not loaded\\\":\\\"sql_database_too_large_to_load\\\",\\\"Database checkpoint exceeds the artifact write limit; not saved\\\":\\\"sql_checkpoint_too_large\\\",\\\"Database checkpoint shrank sharply against the artifact it replaces\\\":\\\"sql_checkpoint_shrank\\\",\\\"Database artifact storage unavailable\\\":\\\"sql_artifact_storage_unavailable\\\",\\\"Database artifact kept changing while it was read\\\":\\\"sql_artifact_changed_during_read\\\",\\\"Artifact part integrity check failed\\\":\\\"artifact_part_hash_mismatch\\\",\\\"Artifact part collection deferred\\\":\\\"artifact_part_collection_deferred\\\",\\\"Durable database artifact does not carry the expected file header; refusing to hydrate\\\":\\\"artifact_header_invalid\\\",\\\"No recorded artifact lineage for a live database; saving without a lineage assertion\\\":\\\"artifact_lineage_missing\\\",\\\"No recorded artifact lineage for a live database; discarding the actor\\\":\\\"artifact_lineage_missing_discarded\\\",\\\"Failed to open database\\\":\\\"database_open_failed\\\",\\\"Failed to promote database to file\\\":\\\"database_promote_failed\\\",\\\"Not enough free disk to promote a database; keeping it in memory\\\":\\\"database_promote_no_disk\\\",\\\"failed to copy view during table copy\\\":\\\"duckdb_view_copy_failed\\\",\\\"Database cache cleanup failed\\\":\\\"duckdb_cache_cleanup_failed\\\",\\\"sql ddl allowed without schema ability (ddl_requires_schema = log)\\\":\\\"sql_ddl_without_schema\\\",\\\"Local SQL commit failed\\\":\\\"sql_commit_failed\\\",\\\"Dead SQL actor detected, respawning\\\":\\\"sql_actor_respawned\\\",\\\"Dead SQL actor detected during export, removing\\\":\\\"sql_actor_dead_on_export\\\",\\\"sql_store shadow upload blocked for a database\\\":\\\"shadow_upload_blocked\\\",\\\"sql_store shadow could not read a manifest row\\\":\\\"shadow_manifest_read_failed\\\",\\\"sql_store shadow lag scan failed\\\":\\\"shadow_lag_scan_failed\\\",\\\"sql_store shadow drained behind PG\\\":\\\"shadow_drained_behind_pg\\\",\\\"sql store mode unreadable; refusing the request\\\":\\\"store_master_mode_unreadable_refused\\\",\\\"store-master backstop rotation failed\\\":\\\"store_master_backstop_rotation_failed\\\",\\\"sql_store: a store-master database has no working copy\\\":\\\"shadow_local_working_copy_missing\\\",\\\"sql_store local source could not read a working copy\\\":\\\"shadow_local_read_failed\\\",\\\"database connection lost\\\":\\\"db_connection_lost\\\",\\\"retries suppressed after a database overload signal\\\":\\\"db_retries_suppressed\\\",\\\"not retrying operation: retries are suppressed after a database overload signal\\\":\\\"db_operation_retry_suppressed\\\",\\\"not retrying operation: the request deadline leaves no room\\\":\\\"db_operation_retry_no_deadline\\\",\\\"retry attempt stopped: the operation budget expired\\\":\\\"db_operation_retry_budget_spent\\\",\\\"Read audit batch timed out\\\":\\\"read_audit_batch_timeout\\\",\\\"failed to refund orphaned KV blob; periodic collector will retry\\\":\\\"kv_blob_refund_failed\\\",\\\"a deleting fence named a blob that a committed write references; it was closed without deleting the blob\\\":\\\"kv_blob_delete_skipped_referenced\\\",\\\"KV orphan collection failed\\\":\\\"kv_orphan_collection_failed\\\",\\\"delegate epoch path failed\\\":\\\"delegate_epoch_path_failed\\\",\\\"epoch insert failed\\\":\\\"epoch_insert_failed\\\",\\\"epoch head backfill stopped at its first error; writes stay correct and repair each space on its next write\\\":\\\"epoch_head_backfill_failed\\\",\\\"invocation referenced a space absent from the database\\\":\\\"invocation_space_missing\\\",\\\"deletion ledger is locked by another process: waiting for it\\\":\\\"deletion_ledger_lock_wait\\\",\\\"deletion ledger replayed at start\\\":\\\"deletion_ledger_replayed\\\",\\\"deletion ledger: committed line was not written\\\":\\\"deletion_ledger_commit_unwritten\\\",\\\"deletion ledger: could not tell whether a delete committed; the operation stays open\\\":\\\"deletion_ledger_commit_unknown\\\",\\\"deletion ledger: the settling line was not written\\\":\\\"deletion_ledger_settle_unwritten\\\",\\\"could not record losing network create ceremony as failed\\\":\\\"network_create_ceremony_mark_failed\\\",\\\"share scope validation failed\\\":\\\"share_scope_validation_failed\\\",\\\"delivery authorization refused\\\":\\\"delivery_authorization_refused\\\",\\\"delivery authorizations refused by the rate limit\\\":\\\"delivery_rate_limited\\\",\\\"deactivated webhook subscriptions; owners must re-register\\\":\\\"hook_subscriptions_deactivated\\\",\\\"webhook egress closed: internal endpoint refresh failed\\\":\\\"webhook_egress_refresh_failed\\\",\\\"webhook egress closed: internal endpoint lookup failed\\\":\\\"webhook_egress_lookup_failed\\\",\\\"webhook delivery mark refused: lease no longer held\\\":\\\"webhook_mark_lease_lost\\\",\\\"webhook delivery lease release failed\\\":\\\"webhook_lease_release_failed\\\",\\\"webhook delivery send skipped: lease no longer held\\\":\\\"webhook_send_lease_lost\\\",\\\"internal renewal scheduler pass failed\\\":\\\"renewal_scheduler_tick_failed\\\",\\\"renewals paused node-wide\\\":\\\"renewals_paused\\\",\\\"renewals resumed node-wide\\\":\\\"renewals_resumed\\\",\\\"the links API clock differs from the node clock\\\":\\\"links_read_clock_skew\\\",\\\"purge ledger reconciliation failed; space traffic stays refused\\\":\\\"space_purge_reconcile_failed\\\",\\\"space purge residue sweep failed\\\":\\\"space_purge_sweep_failed\\\",\\\"space purge phase failed; retrying later\\\":\\\"space_purge_phase_failed\\\",\\\"space purge attempt release failed\\\":\\\"space_purge_release_failed\\\",\\\"space purge claim failed\\\":\\\"space_purge_claim_failed\\\",\\\"owner erasure pass failed; retrying later\\\":\\\"owner_erasure_pass_failed\\\",\\\"skipped invalid space directories while measuring storage\\\":\\\"storage_invalid_space_dirs\\\",\\\"removed setting is set and ignored; delete it from the configuration\\\":\\\"removed_setting_ignored\\\",\\\"admin stats result exceeds its bound\\\":\\\"admin_stats_over_bound\\\",\\\"admin stats query failed\\\":\\\"admin_stats_query_failed\\\",\\\"TDX quote unavailable\\\":\\\"attestation_quote_unavailable\\\",\\\"dstack guest agent returned an error\\\":\\\"dstack_guest_agent_error\\\",\\\"tunnel: failed to build upstream HTTP client\\\":\\\"tunnel_upstream_client_failed\\\"}\\n known = get(codes, [msg]) ?? null\\n if is_string(known) { code = known }\\n if starts_with(msg, \\\"quota service returned \\\") { code = \\\"quota_fallback\\\" }\\nif starts_with(msg, \\\"Failed to get TDX quote: \\\") { code = \\\"attestation_quote_failed\\\" }\\nif starts_with(msg, \\\"created a new node identity at \\\") { code = \\\"node_identity_created\\\" }\\nif starts_with(msg, \\\"quota service returned an invalid body: \\\") { code = \\\"quota_invalid_body\\\" }\\nif starts_with(msg, \\\"dstack socket available but get_info failed: \\\") { code = \\\"dstack_get_info_failed\\\" }\\n # TC-3284: a line with no message is named by its constant `event` field, only when that event is listed.\\n if msg == \\\"\\\" && !exists(f.message) {\\n events = {\\\"did_resolution_refused\\\":\\\"did_resolution_refused\\\",\\\"renewal_scheduler_lease_failed\\\":\\\"renewal_scheduler_lease_failed\\\",\\\"session_retire_failed\\\":\\\"session_retire_failed\\\"}\\n named = get(events, [string(f.event) ?? \\\"\\\"]) ?? null\\n if is_string(named) { code = named }\\n }\\n }\\n if level == \\\"warn\\\" && target == \\\"rocket::config::config\\\" && msg == \\\"found value for deprecated config key `log`\\\" { code = \\\"rocket_deprecated_log_config\\\" }\\nif level == \\\"warn\\\" && target == \\\"rocket::launch\\\" && starts_with(msg, \\\"Rocket has launched from \\\") { code = \\\"rocket_launched\\\" }\\n event = if level == \\\"warn\\\" { \\\"node_warning\\\" } else { \\\"node_error\\\" }\\n out = {\\\"event\\\": event, \\\"svc\\\": \\\"api\\\", \\\"level\\\": level, \\\"event_code\\\": code, \\\"event_count\\\": 1}\\n }\\n} else {\\n ts = string!(j.time)\\n method = string!(j.method)\\n route = string!(j.route)\\n if route == \\\"\\\" { route = \\\"\\\" }\\n if !includes([\\\"GET\\\",\\\"HEAD\\\",\\\"POST\\\",\\\"PUT\\\",\\\"PATCH\\\",\\\"DELETE\\\",\\\"OPTIONS\\\",\\\"\\\"], method) || !includes([\\\"/healthz\\\",\\\"/info\\\",\\\"/version\\\",\\\"/invoke\\\",\\\"/delegate\\\",\\\"/revoke\\\",\\\"/attestation\\\",\\\"/signed/kv\\\",\\\"/signed/kv/\\\",\\\"/admin/quota\\\",\\\"/admin/quota/\\\",\\\"/admin/usage\\\",\\\"/admin/stats\\\",\\\"/hooks/events\\\",\\\"/hooks/tickets\\\",\\\"/hooks/webhooks\\\",\\\"/hooks/webhooks/\\\",\\\"/delegation/query\\\",\\\"/delegation/status\\\",\\\"/encryption/networks\\\",\\\"/encryption/networks/\\\",\\\"/encryption/networks//revoke\\\",\\\"/encryption/networks//decrypt\\\",\\\"/policy/v3/status\\\",\\\"/policy/v3/status/\\\",\\\"/policy/v3/policies\\\",\\\"/policy/v3/challenges\\\",\\\"/policy/v3/delegations\\\",\\\"/policy/v3/enforcer-bindings\\\",\\\"/policy/v3/deliveries/authorize\\\",\\\"/.well-known/tinycloud/node-keys\\\",\\\"/.well-known/encryption/network/\\\",\\\"/public//kv\\\",\\\"/public//kv/\\\",\\\"/peer/generate/\\\",\\\"/evidences/\\\",\\\"/share/v2/readiness\\\",\\\"/share/v2/policies\\\",\\\"/share/v2/policy/challenges\\\",\\\"/share/v2/policy/session\\\",\\\"/share/v2/invoke\\\",\\\"/share/v2/deliveries/authorize\\\",\\\"/<_s..>\\\",\\\"/public/<_space_id>/kv/<_key..>\\\",\\\"\\\"], route) { abort }\\n status = j.status\\n request_time = j.request_time\\n if !is_integer(status) || !(is_integer(request_time) || is_float(request_time)) { abort }\\n status = int!(status)\\n request_time = to_float!(request_time)\\n if status < 100 || status > 599 || request_time < 0 || request_time > 86400 { abort }\\n out = {\\\"event\\\": \\\"ingress_request\\\", \\\"svc\\\": \\\"ingress\\\", \\\"level\\\": \\\"info\\\", \\\"method\\\": method, \\\"route\\\": route, \\\"status\\\": status, \\\"request_time_seconds\\\": request_time}\\n}\\nif length(ts) > 64 { abort }\\nparsed_ts = parse_timestamp!(ts, format: \\\"%+\\\")\\nout.ts = format_timestamp!(parsed_ts, format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\")\\n. = out\\n\",\"drop_on_error\":true,\"drop_on_abort\":true,\"reroute_dropped\":true},\"gate_counts\":{\"type\":\"remap\",\"inputs\":[\"gate_route.rejected\",\"gate_route._unmatched\",\"allowlist.dropped\",\"event_route._unmatched\"],\"source\":\"reason = .reason\\nif !includes([\\\"malformed_envelope\\\",\\\"unexpected_label\\\",\\\"unlabelled\\\",\\\"non_json\\\",\\\"oversized\\\",\\\"partial\\\",\\\"invalid_fields\\\",\\\"unknown_target\\\",\\\"filtered_level\\\"], reason) { reason = \\\"invalid_fields\\\" }\\n. = {\\\"reason\\\": reason, \\\"count\\\": 1}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"gate_reduce\":{\"type\":\"reduce\",\"inputs\":[\"gate_counts\"],\"group_by\":[\"reason\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"count\":\"sum\"}},\"gate_output\":{\"type\":\"remap\",\"inputs\":[\"gate_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": \\\"warn\\\", \\\"event\\\": \\\"logship_gate_summary_total\\\", \\\"svc\\\": \\\"logship\\\", \\\"reason\\\": .reason, \\\"count\\\": .count}\",\"drop_on_error\":true,\"drop_on_abort\":true},\"request_profile\":{\"type\":\"filter\",\"inputs\":[\"allowlist\"],\"condition\":\"\\\"$${TINYCLOUD_LOGSHIP_PROFILE}\\\" == \\\"all_requests\\\" || includes([\\\"node_warning\\\",\\\"node_error\\\",\\\"node_storage_headroom\\\",\\\"delegation_mode_boot_reindex\\\",\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\",\\\"deletion_ledger_start\\\"], .event) || (int(.status) ?? 0) >= 400 || (.event == \\\"node_request\\\" && (int(.latency_us) ?? 0) > 1000000) || (.event == \\\"ingress_request\\\" && (to_float(.request_time_seconds) ?? 0.0) > 1.000000)\"},\"event_route\":{\"type\":\"route\",\"inputs\":[\"request_profile\"],\"route\":{\"request\":\"(.event == \\\"node_request\\\" || .event == \\\"ingress_request\\\") && !(((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)) && !((int(.status) ?? 0) >= 500)\",\"node_request_5xx\":\".event == \\\"node_request\\\" && (int(.status) ?? 0) >= 500\",\"ingress_request_5xx\":\".event == \\\"ingress_request\\\" && (int(.status) ?? 0) >= 500\",\"node_request_4xx\":\".event == \\\"node_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"ingress_request_4xx\":\".event == \\\"ingress_request\\\" && ((int(.status) ?? 0) >= 400 && (int(.status) ?? 0) < 500)\",\"db_failure_5xx\":\".event == \\\"node_warning\\\" && .event_code == \\\"db_failure_5xx\\\"\",\"storage_headroom\":\".event == \\\"node_storage_headroom\\\"\",\"delegation_mode_boot_reindex\":\".event == \\\"delegation_mode_boot_reindex\\\"\",\"deletion_ledger\":\"includes([\\\"deletion_ledger_open_failed\\\",\\\"deletion_ledger_replay_failed\\\",\\\"deletion_ledger_unrepaired\\\"], .event)\",\"deletion_ledger_start\":\".event == \\\"deletion_ledger_start\\\"\",\"diagnostic\":\"(.event == \\\"node_warning\\\" && .event_code != \\\"db_failure_5xx\\\") || .event == \\\"node_error\\\"\"}},\"cap_db_failure_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.db_failure_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"db_failure_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_5xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_5xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_5xx\\\"\\nlocal cap = 10\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_node_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.node_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"node_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"cap_ingress_request_4xx\":{\"type\":\"lua\",\"version\":\"2\",\"inputs\":[\"event_route.ingress_request_4xx\"],\"hooks\":{\"process\":\"process\"},\"timers\":[{\"interval_seconds\":60,\"handler\":\"flush\"}],\"source\":\"local class = \\\"ingress_request_4xx\\\"\\nlocal cap = 3\\nlocal passed = 0\\nlocal dropped = 0\\nlocal ticks = 0\\nfunction process(event, emit)\\n if passed < cap then\\n passed = passed + 1\\n emit(event)\\n else\\n dropped = dropped + 1\\n end\\nend\\nfunction flush(emit)\\n ticks = ticks + 1\\n if ticks == 1 then return end\\n if dropped > 0 then\\n emit({log = {ts = os.date(\\\"!%Y-%m-%dT%H:%M:%S.000Z\\\"), level = \\\"warn\\\", event = \\\"node_warning\\\", svc = \\\"api\\\", event_code = \\\"errors_dropped\\\", class = class, dropped = dropped, window_s = 60}})\\n end\\n passed = 0\\n dropped = 0\\nend\"},\"diagnostic_reduce\":{\"type\":\"reduce\",\"inputs\":[\"event_route.diagnostic\"],\"group_by\":[\"event\",\"event_code\",\"level\",\"svc\"],\"end_every_period_ms\":60000,\"expire_after_ms\":75000,\"flush_period_ms\":1000,\"merge_strategies\":{\"event_count\":\"sum\",\"ts\":\"discard\"}},\"diagnostic_output\":{\"type\":\"remap\",\"inputs\":[\"diagnostic_reduce\"],\"source\":\". = {\\\"ts\\\": format_timestamp!(now(), format: \\\"%Y-%m-%dT%H:%M:%S%.3fZ\\\"), \\\"level\\\": .level, \\\"event\\\": .event, \\\"svc\\\": \\\"api\\\", \\\"event_code\\\": .event_code, \\\"event_count\\\": .event_count}\",\"drop_on_error\":true,\"drop_on_abort\":true}},\"sinks\":{\"betterstack\":{\"type\":\"http\",\"inputs\":[\"event_route.request\",\"event_route.storage_headroom\",\"event_route.delegation_mode_boot_reindex\",\"event_route.deletion_ledger\",\"event_route.deletion_ledger_start\",\"cap_db_failure_5xx\",\"cap_node_request_5xx\",\"cap_ingress_request_5xx\",\"cap_node_request_4xx\",\"cap_ingress_request_4xx\",\"diagnostic_output\",\"gate_output\"],\"method\":\"post\",\"uri\":\"https://s2795437.us-west-2a.betterstackdata.com/\",\"encoding\":{\"codec\":\"json\"},\"framing\":{\"method\":\"newline_delimited\"},\"compression\":\"gzip\",\"auth\":{\"strategy\":\"bearer\",\"token\":\"SECRET[bs.bs_token]\"},\"batch\":{\"max_bytes\":262144,\"timeout_secs\":1},\"buffer\":{\"type\":\"memory\",\"max_events\":1000,\"when_full\":\"block\"},\"request\":{\"timeout_secs\":10,\"retry_max_duration_secs\":300},\"healthcheck\":{\"enabled\":false}}},\"secret\":{\"bs\":{\"type\":\"directory\",\"path\":\"/var/lib/vector/secrets\",\"remove_trailing_whitespace\":true}}}" entrypoint: - /bin/sh - -ec From 1e2234e2227e43f5911764662a81542555af541e Mon Sep 17 00:00:00 2001 From: "tinycloud-bot[bot]" <348376441+tinycloud-bot[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 03:34:08 +0000 Subject: [PATCH 4/5] ci(logship): boundary job timeout 20 -> 35 minutes (TC-4177) - The job already ran 16-19 min on main; the added Vector cases for deletion_ledger_start pushed it past 20 and CI cancelled it (run 45446418043, 17:14:52Z-17:35:07Z). CI-only change, nothing else. Details: TC-4177 --- .github/workflows/logship.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logship.yml b/.github/workflows/logship.yml index fa38302d..d91a51e3 100644 --- a/.github/workflows/logship.yml +++ b/.github/workflows/logship.yml @@ -29,7 +29,7 @@ concurrency: jobs: boundary: runs-on: ubuntu-latest - timeout-minutes: 20 + timeout-minutes: 35 steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: From 092f94f49f9cf10c2ff6c42fb5010140cf51c9a7 Mon Sep 17 00:00:00 2001 From: "tinycloud-bot[bot]" <348376441+tinycloud-bot[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 13:19:23 +0000 Subject: [PATCH 5/5] log-shipper: re-pin canonical.json to the dev-sam merge commit 72947b18 (TC-4177) - revision 764c32a9 (branch head) -> 72947b183d4aa0df5ba6e3ddf42583888b4a3cd9 (squash merge of dev-sam #384). fields.json at that commit hashes to 9abea684d4b9e396f67b7a612733d6f788d35f9b1a5ae806430644b6c3a2ba9b, unchanged; nothing else derives from the revision. Details: TC-4177 --- log-shipper/canonical.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/log-shipper/canonical.json b/log-shipper/canonical.json index 39cc6918..a891791a 100644 --- a/log-shipper/canonical.json +++ b/log-shipper/canonical.json @@ -1,6 +1,6 @@ { "repo": "samgbafa/tinycloud-dev", - "revision": "764c32a9c3a8cc9f050f10e40a46e47cabfbe9eb", + "revision": "72947b183d4aa0df5ba6e3ddf42583888b4a3cd9", "path": "ops/logging/fields.json", "sha256": "9abea684d4b9e396f67b7a612733d6f788d35f9b1a5ae806430644b6c3a2ba9b" }