Monitoring and routine operations
Monitoring should distinguish service availability from cryptographic or operational trust. A healthy HTTP response does not prove that a gateway is honest, that a threshold was independently checked, or that a log is append-only.
Health and metrics
Use the gateway's /health for liveness and poll each signer's /health
for clock: "ok" (HTTP 200) or "unhealthy" (HTTP 503):
curl -f https://gateway.example.com/health
The gateway exposes /metrics. Configure WITNESS_METRICS_TOKEN and send
Authorization: Bearer <token>, or block the endpoint at the reverse proxy.
Without either control, metrics are public.
Useful signals include:
- total attestations and attestations in the last 24 hours;
- signatures collected per witness;
- batch counts;
- witness health;
- request duration and process uptime.
The currently documented metric names include
witness_attestations_total, witness_signatures_collected,
witness_batches_total, witness_attestations_24h,
witness_witness_health, witness_uptime_seconds, and
witness_request_duration_seconds.
Watch for threshold failures, witness availability changes, unusual admission volume, database errors, and unexpected authentication failures. Per-IP limits are only defense in depth and should not be treated as an abuse-control perimeter.
Monitor WebSocket connections and route exposure as well. /ws/events requires
WITNESS_WS_AUTH_TOKEN; when it is unset the endpoint is disabled (HTTP 503 on
upgrade) and startup logs a warning. There is no unauthenticated stream.
Authenticated subscribers receive confirmed attestations only — one event after
the reconciler persists a signed, servable attestation — so there is no
pre-confirmation reservation or submission-timing feed.
Independent STH auditing
Run witness-auditor with a separately obtained public-key pin.
check performs one cycle and watch keeps polling.
Both authenticate key history against the pin and check the signatures of
each checkpoint using its own epoch's keys:
witness-auditor --gateway https://gateway.example.com \
--network-config /etc/witness/network-verification.json check
witness-auditor --gateway https://gateway.example.com \
--network-config /etc/witness/network-verification.json watch --interval 60
The auditor never uses the target gateway's /v1/network response as its trust
anchor. Keep its SQLite database on persistent storage, preferably in a
separate failure domain from the gateway. Use status and history to inspect
accepted checkpoints and recorded anomalies; those read-only commands do not
require a network pin.
Compare signers (split-view detection)
Give the auditor each signer's public URL so it can fetch the checkpoint each
signer last signed (GET /<origin hash>/checkpoint on the signer) and check it against
the gateway's history:
witness-auditor --gateway https://gateway.example.com \
--network-config /etc/witness/network-verification.json \
watch --interval 60 \
--signer signer-1=https://signer1.example.org \
--signer signer-2=https://signer2.example.org \
--signer signer-3=https://signer3.example.org
A signer whose signed checkpoint is not consistent with the gateway's history
(or with another signer's at the same size) is recorded as a split_view
anomaly. The anomaly keeps both signed objects as evidence, and check exits
non-zero. An unreachable signer is reported as a warning. Run the auditor from
somewhere that reaches the signers directly, not through the gateway.
Otherwise a dishonest gateway can control what the auditor sees.
Use --monitor-witness 'VKEY=https://witness.example/monitor' to compare an
independent witness in the same way. Use --witness-policy FILE if the
gateway's checkpoint must include signatures from specific witnesses. The
policy file has the same format as the client policy.
Keep all repetitions of a monitoring flag together after check or watch.
Freshness
The gateway asks signers to sign the current tree again every
WITNESS_CHECKPOINT_REFRESH_SECS (default 600). The auditor measures age from
fresh_as_of, the oldest clock reading among the minimum number of latest
valid signer readings. It records a stale_checkpoint anomaly when the latest
checkpoint is older than --max-checkpoint-age (default 3600; 0 disables).
Keep the age comfortably above the refresh interval plus the batch period.
Alert on any anomaly. Require inclusion for receipts that must be logged: the auditor cannot prove the log is complete, only that it is alive and that the signers saw the same history.
Evidence records
When the gateway issues evidence records, it also reports:
| Metric | Meaning |
|---|---|
witness_evidence_batches{state} |
Batches waiting for a token (reserved), waiting for a CRL (timestamped), and published (complete). |
witness_evidence_oldest_unfinished_age_seconds |
Age of the oldest batch that is not yet published (0 when none). |
witness_evidence_receipts_waiting |
Confirmed receipts whose records are not yet published. |
witness_evidence_last_complete_timestamp_seconds |
When a batch was last published. |
witness_evidence_failures_total{stage} |
Failed token requests (timestamp), failed completions (complete), and checks that found no new enough CRL yet (pending). |
A reasonable alert is an unfinished batch older than the TSA's CRL publishing
interval plus a few batch periods. For custodians, alert when
witness-custodian renew exits non-zero or watch logs an error-level
summary: a record is overdue or expired, or a renewal failed.
Common operational symptoms
If startup reports a missing witness auth_token, every witness entry in
network.json needs a non-empty token. Do not bypass this check by placing a
public signing endpoint in front of an unauthenticated witness.
If SQLite reports that the database is locked, confirm that only one gateway process uses the database file. The gateway is not a multi-writer SQLite cluster.
If timestamp requests have high tail latency, inspect witness health and latency. An unreachable or slow witness can delay threshold collection even though collection stops once the configured threshold is reached.
After a prolonged witness outage, inspect the age of pending/retryable jobs and
the configured signing window. Job timestamps do not change. Once
the window expires, the stable terminal result is
last_error: "signing_deadline_exceeded"; do not expect a refreshed timestamp.
Submitting the same hash returns the failed job.
If a signer becomes unhealthy, verify its time source and kernel sync status where applicable. It pauses after a wall-clock jump. Do not delete a checkpoint state file to clear a checkpoint error; first investigate whether the gateway and signer agree on the log history.
Logs
Set RUST_LOG to control tracing verbosity. Use normal verbosity for routine
operation and increase it temporarily for troubleshooting. Review log and
reverse-proxy retention because source IPs, timing, User-Agent strings, paths,
and application identifiers can be identifying metadata. Never log private
keys, bearer tokens, or full secret-bearing configuration.
Operational logs and the SQLite database are not automatically tamper-evident. For independent evidence, clients should verify attestations and proof bundles, and auditors should verify signed tree-head and consistency-proof chains.
Incident first actions
If a key, bearer token, API key, database, or deployment configuration may have been exposed:
- Restrict the affected service and preserve relevant logs and configuration safely.
- Determine which network, signer, or route was affected.
- Check receipts, signed checkpoints, consistency proofs, and independent verification for anomalous behavior.
- Restore only from a known-good database/configuration backup when required.
- Update the reviewed configuration and restart services deliberately.
For signing-key compromise, follow Key management and make sure clients obtain and pin the replacement key file independently.