Collect logs from every machine into one place that you can search.
Log aggregation means collecting the logs from every server, container and service into one central place, so you can search them all together.
Imagine 200 containers, each writing its own log file. An engineer who wants to see what happened to one request would have to log in to dozens of machines, and the container that served it may already be gone. That does not work. Log aggregation solves it by copying every log line to a central system as soon as it is written.
The usual pipeline has four stages: collect (an agent such as Fluent Bit or Filebeat reads the log), transport (often through a buffer such as Kafka, so bursts do not overload the next stage), process (parse JSON, add fields, drop or mask data) and store and search (an index in Elasticsearch, Loki, Splunk or a cloud service).
| Stage | Job | Examples | Watch out for |
|---|---|---|---|
| Collect | Read log files or streams on each machine | Fluent Bit, Fluentd, Filebeat, Vector, a cloud agent | Agent CPU and memory on every host. Do not lose lines on restart. |
| Buffer / transport | Hold lines safely between stages | Kafka, a cloud queue, the agent's own disk buffer | Buffer size. When it is full, lines are dropped or senders slow down. |
| Process | Parse, add fields, mask, drop, route | Logstash, Fluentd, Vector, ingest pipelines | Slow parsing becomes the bottleneck. Bad parsing loses fields. |
| Store and index | Make the lines searchable | Elasticsearch / OpenSearch, Loki, Splunk, cloud log services | Index size and cost. Slow queries on wide time ranges. |
| Search and alert | Query, view and alert | Kibana, Grafana, vendor consoles | Access control and expensive queries. |
The bars are only a rough picture of the trade-off, not measured values.
Every agent sends straight to the indexer. When the indexer is full, the extra lines are dropped (or the senders slow down).
A simplified model with a simulated clock (no random numbers). Illustrative assumptions: 300 bytes per line, DEBUG is 60% of all lines, and the buffer holds 60,000 lines. Real systems also compress logs and add index overhead, so real storage differs.
| Term | Meaning in easy words |
|---|---|
| Log aggregation | Collecting logs from many sources into one central system |
| Agent / shipper | A small program on each machine that reads logs and sends them on |
| Pipeline | The chain of stages from collection to storage |
| Buffer | A queue that holds lines between stages, so bursts do not cause loss |
| Parsing | Turning a raw line into named fields |
| Enrichment | Adding fields such as service name, region or version |
| Index | A data structure that makes logs fast to search |
| Retention | How long logs are kept before they are deleted |
| Hot / cold storage | Fast and costly storage for recent logs versus slow and cheap storage for old ones |
| Backpressure | A slow stage telling earlier stages to slow down or wait |
| ELK / Elastic stack | Elasticsearch, Logstash and Kibana, a well-known log stack |
| Choice | We gain | We lose |
|---|---|---|
| Straight to the indexer | A simple pipeline | Lines are lost in a burst or an outage |
| Through a buffer (Kafka) | No loss in bursts, replay is possible | One more system, and some extra delay |
| Index everything | Search any word in any line | High storage and CPU cost |
| Index labels only | Much lower cost | Searching text inside lines is slower |
| Long retention | Investigate old incidents and meet audit rules | Cost grows with every day kept |
| Short retention | Low cost and less data to protect | Old evidence is gone |