← Back to microservices patterns map
🪵
Microservices Pattern

Centralized Logging

Aggregate structured logs from all services into one searchable place.

logs

Detailed Description

Centralized logs turn scattered service output into a debugging system.

Use structured JSON logs and avoid logging secrets or sensitive payloads.

Visual Diagram

Log Aggregation Pipeline
  ServiceA → { traceId, level, msg, ts }
  ServiceB → { traceId, level, msg, ts }
  ServiceC → { traceId, level, msg, ts }
        ↓ log shipper (Fluentd / Filebeat)
  [Central Store: Elasticsearch / Loki]
        ↓
  [Dashboard: Kibana / Grafana]
  search: traceId=abc-123 → all logs

Tradeoffs

Pros

Single search surface, cross-service correlation

Cons

Cost and PII risk at scale

Examples: ELK, Loki + Grafana, Datadog logs, CloudWatch