Log Aggregation

Centralized logs across services. Three storage models: full-text indexed (Elasticsearch / OpenSearch), label-indexed (Loki, ~10x cheaper), columnar (ClickHouse, hyperscale). Collection layer: Fluent Bit / Vector / Promtail / OpenTelemetry. Cost vs query power trade-off.

Overview

Logs: the most detail, at the highest cost

Logs are the third leg of observability after metrics and traces. They carry the most semantic detail per event, at the highest cost per useful query. Modern log aggregation balances cost (storage and indexing) against query capability.

Every stack has the same shape. Containers write their logs to stdout, which is ephemeral: the output disappears with the container. A forwarder runs on every node as a Kubernetes DaemonSet (one copy per node), reads that output and ships it on. The forwarder is usually Fluent Bit, Vector, Promtail or the OpenTelemetry (OTel) Collector. It sends the logs to one of four kinds of backend: Elasticsearch or OpenSearch with a full-text index, Loki with a label index only, ClickHouse with columnar storage and SQL, or a SaaS product such as Datadog, Splunk or New Relic.

Key concepts

  • Loki vs Elasticsearch — cost and query trade-offs
  • LogQL — Loki query language
  • Forwarder choice — Fluent Bit, Vector, Promtail, OTel Collector
  • Structured logging best practices
  • Recipe: Loki + Promtail on EKS with multi-tenant retention

Interview questions

  • How do you choose between Loki and Elasticsearch?
  • Walk through structured logging best practices and PII handling.
  • How do you correlate logs with traces and metrics?
  • How do you control log volume and cost at scale?
  • Quick-fire interview answers — log aggregation essentials.

Sign up free to read the full topic

More Observability topics

Start free on Cariara · Coding problems · System design studio