Logs
Cheat sheet · https://pcornel.dk/topic.php?topic=6100
Answer
Logs are timestamped records of discrete events, ideally structured (JSON) with fields such as level, service, message and trace_id.
Remember
Structure logs, include correlation IDs, never log secrets or personal data unnecessarily, and set retention by value. Logs are expensive at volume — sample or drop noise.
First checks
journalctl -u <svc> -p err --since -1h— first check for this topiccurl -s localhost:9090/-/ready— Prometheus readycurl -s 'localhost:9090/api/v1/query?query=up'— scrape targets up/downpromtool check config prometheus.yml— config valid
Verify in this order
app writes log → agent ships → parsed/enriched → indexed/stored → queried
Where it usually breaks
Failures include parsing rules that drop fields, clock skew reordering events, multiline stack traces split incorrectly, log rotation/retention removing context, duplicate ingestion and severity labels that do not reflect operational impact.
Logs verification boundary matrix
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | Structured vs unstructured logs | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | Severity / Timestamps/time zones | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | Correlation/request IDs | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | Parsing/enrichment | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6100