✦ For everyone, free.

Practical knowledge for real and everyday life

Home

9.4.3.1 Logs Service Aggregation

A focused guide to Logs Service Aggregation, connecting core concepts with practical Docker and container operations.

Logs service aggregation is docker compose logs's ability to combine and interleave log output from multiple services into a single, unified stream, clearly labeled by source, rather than requiring separate inspection of each service's logs through individual commands.

Combined, Labeled Output Across Services

Requesting logs without limiting to a specific service produces output from every running service, interleaved in roughly chronological order and clearly labeled by originating service.

docker compose logs -f
db_1   | 2026-06-24 10:15:02 database system is ready to accept connections
api_1  | 2026-06-24 10:15:03 Server listening on port 8080
api_1  | 2026-06-24 10:15:05 Handling request: GET /health

This interleaved view makes it possible to see how events across different services relate to each other in time, something checking each service's logs separately wouldn't as naturally reveal.

Why This Aggregation Is Valuable for Debugging Cross-Service Issues

A problem that spans multiple services — a request failing partway through a chain of service-to-service calls, for instance — is often easier to diagnose when log output from all the involved services can be viewed together, in their actual chronological relationship to one another.

docker compose logs -f api db cache

Limiting aggregation to a specific, relevant subset of services keeps the combined view focused on exactly the services involved in whatever's being investigated.

Filtering Aggregated Output for a Specific Pattern

Piping aggregated log output through a filtering tool helps narrow in on specific, relevant entries within the combined stream.

docker compose logs | grep ERROR
Why Logs Service Aggregation Matters

This aggregated, clearly labeled view across multiple services is one of Compose's most practically useful debugging capabilities, providing insight into cross-service behavior that would be considerably more cumbersome to reconstruct by checking each service's logs in isolation.