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
| Concern | Message-oriented logs | Canonical structured events |
|---|---|---|
| Primary unit | One message about a local code path | One completed workflow or meaningful state change |
| Context | Often spread across many lines and services | Stable identifiers, outcome, duration, and dimensions together |
| Analysis | Search and parsing patterns | Typed filters, groups, joins, percentiles, funnels, and cohorts |
| Schema | Implicit in prose and formatting | Named fields with explicit types, units, and allowed values |
A canonical completion event
{
"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.
Turn the event into an operational answer
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
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.Detect a meaningful change in rate, latency, cost, or volume.
- 2.Confirm the time window, denominator, and event freshness.
- 3.Break down the change by a bounded ownership or rollout dimension.
- 4.Inspect correlated events for the affected requests or accounts.
- 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 guideAnalyze
Start from a tested SQL pattern for reliability, jobs, product, revenue, AI, or data quality.
Browse SQL recipesOperate
Verify ingestion and query behavior before promoting a result to a dashboard or alert.
Troubleshoot ingestionStart 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.