Telemetry
Practical structured logging guide

Structured log management built around questions, not strings

Model important application outcomes as typed JSON events. Keep the context needed to debug, measure, and improve a workflow together—then use readable SQL to turn those events into results a team can verify.

The workflow

  1. 1Instrument a completed unit of work
  2. 2Ingest typed, privacy-conscious JSON
  3. 3Query an explicit business question
  4. 4Share the result as a chart, dashboard, export, or alert

Definition

What structured log management changes

Traditional application logs are valuable for narrating local execution, but important questions usually cross many messages: Did the checkout finish? Which accounts were affected? Did a retry recover? Did the new release change latency? A structured event records the outcome and its analytical context as one typed object.

Structured log management is the practice of defining those objects, controlling their schema and privacy boundary, retaining them as queryable tables, and operating the resulting searches, SQL queries, visualizations, dashboards, and alerts. It complements traces and metrics; it does not require every debug message to become a business event.

A useful event earns its fields

Start from questions and decisions. Every field should help filter, group, correlate, calculate, protect, or explain the workflow. Unbounded payloads create cost and privacy risk without guaranteeing better answers.

Text logs and structured events

Different shapes for different jobs

ConcernMessage-oriented logsCanonical structured events
Primary unitOne message about a local code pathOne completed workflow or meaningful state change
ContextOften spread across many lines and servicesStable identifiers, outcome, duration, and dimensions together
AnalysisSearch and parsing patternsTyped filters, groups, joins, percentiles, funnels, and cohorts
SchemaImplicit in prose and formattingNamed fields with explicit types, units, and allowed values
JSON

A canonical completion event

json
{
  "event": "checkout_completed",
  "timestamp": "2026-07-28T18:42:16Z",
  "request_id": "req_01K1A9",
  "account_id": "acct_812",
  "plan": "growth",
  "status": "success",
  "duration_ms": 842,
  "amount_usd": 129.00,
  "payment": {
    "provider": "stripe",
    "attempt": 1
  }
}

Event contract

Design rules that keep analysis durable

Choose the decision boundary

Emit an event when a request, job, webhook, agent run, billing change, or product milestone reaches an outcome someone may need to explain.

Capture enough context once

Include a stable event name, UTC time, status, duration, environment, release, safe identifiers, and the bounded dimensions required by known questions.

Preserve types and units

Keep numbers as numbers, booleans as booleans, and units in field names. Avoid parsing latency, money, or counts from message strings later.

Constrain sensitive content

Exclude secrets, credentials, authorization headers, raw prompts, payment details, and unnecessary personal data. Prefer categorized error context.

DataFusion SQL

Turn the event into an operational answer

sql
SELECT
  date_trunc('hour', timestamp_utc) AS hour,
  COUNT(*) AS checkouts,
  SUM(CASE WHEN status = 'success' THEN 1 ELSE 0 END) AS succeeded,
  ROUND(
    100.0 * SUM(CASE WHEN status = 'success' THEN 1 ELSE 0 END)
      / NULLIF(COUNT(*), 0),
    2
  ) AS success_rate_pct,
  approx_percentile_cont(duration_ms, 0.95) AS p95_duration_ms
FROM checkout_events
WHERE timestamp_utc >= now() - INTERVAL '24 hours'
GROUP BY date_trunc('hour', timestamp_utc)
ORDER BY hour;

Read the trend and the denominator together

14:00
99.4%
15:00
98.9%
16:00
94.7%
17:00
97.8%

A chart reveals the 16:00 change; the same query preserves checkout count and p95 duration for interpretation. Break the affected hour down by release, provider, plan, or account only after confirming the denominator is large enough.

Investigation sequence

  1. 1.Detect a meaningful change in rate, latency, cost, or volume.
  2. 2.Confirm the time window, denominator, and event freshness.
  3. 3.Break down the change by a bounded ownership or rollout dimension.
  4. 4.Inspect correlated events for the affected requests or accounts.
  5. 5.Save the validated query and document the response.

Instrument

Use the structured logging and schema guides to define safe, typed event contracts.

Open instrumentation guide

Analyze

Start from a tested SQL pattern for reliability, jobs, product, revenue, AI, or data quality.

Browse SQL recipes

Operate

Verify ingestion and query behavior before promoting a result to a dashboard or alert.

Troubleshoot ingestion

Start with one workflow

Send a synthetic event and answer the first question

Prove the event contract with safe test data before expanding instrumentation across the application.

Explore structured events