Pcornel
Automation · Logging & Observability

Structured Logging

Cheat sheet · https://pcornel.dk/topic.php?topic=5960

Back to the Topic

Answer

Structured Logging emits automation events as machine-parseable records with stable field names and types so runs can be searched, correlated, aggregated and alerted on without brittle parsing of human-oriented text.

Remember

  • JSON text ≠ well-designed structured logging.
  • Field present ≠ field semantics stable.
  • Parser success ≠ data complete or trustworthy.
  • Redacted display ≠ secret absent from original event.

First checks

  • JSON log format — structure
  • jq 'select(.level=="error")' automation.log — query
  • Common fields (timestamp, run_id, target, action, status) — schema

Verify in this order

event → JSON log → queries

Where it usually breaks

Structured syntax proves machine readability, not semantic correctness, completeness, safe redaction or reliable delivery to the observability backend.

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Structured Logging observability proof-boundary map

BoundaryHealthy evidenceSuspicious evidence
Identity / scopeImmutable source plus run/job/attempt and exact target IDs are explicitFloating source, shared labels or ambiguous target scope make events hard to attribute
Telemetry pathStructured logs, metrics and traces are exported, timestamped, retained and correlatedConsole-only output, missing data or broken correlation silently creates blind spots
Effective outcomeJob status is paired with target read-back and workload/service acceptanceGreen execution state substitutes for effective target or service verification
Monitoring / closureRates, latency, freshness and alerts use explicit windows/objectives and tested recoveryUntested alerts, stale dashboards or one successful sample are treated as healthy system proof

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5960

Confirmation

Confirm action

Continue?