Chapter 95: Logging with Loki, Elastic Stack and CloudWatch
95.3 The pipeline — agent, collector, storage and query
Story (fictional teaching scenario). At a fictional Nagpur company, Arjun and Chloe from Paris draw the route before installing an agent. They avoid collecting an entire shared machine by accident.
Why
A missing event can disappear at several boundaries; a pipeline diagram tells us where to check.
What
- An agent reads selected data near the application.
- A collector receives, transforms or forwards events; one program may play both roles.
- A buffer temporarily holds events during a slowdown.
- Backpressure means a slower downstream stage limits upstream progress.
- A checkpoint remembers read position; storage retains data and the query layer searches it.
How
-
Select only approved synthetic sources in a lab.
-
Redact before the first durable or remote copy.
-
Track input, rejected, queued and delivered counts.
-
Set bounded buffering and an explicit overflow policy.
Example 1: Count each boundary
- Read the command or request.
Application emits 6 events
Collector accepts 6 events
Storage accepts 5 events
Query returns 5 events
- Read the result.
Output (illustrative; NOT executed against Loki, Elastic or CloudWatch)
Investigate the collector-to-storage boundary before rewriting the query.
- Line by line: These numbers are illustrative pipeline counters. Accepted by a collector is not proof of durable storage. A buffer that grows forever can exhaust disk, and dropping on overflow needs an explicit operational decision, not a hidden default.
Ravindra Bagale's Tip
An agent running is not proof that logs arrived.
Agent चालू आहे म्हणजे logs पोहोचलेच असं नाही.
Agent चल रहा है तो logs पहुँचे ही होंगे, ऐसा नहीं.
Did you understand? Let us try it once more.