Chapter 95: Logging with Loki, Elastic Stack and CloudWatch
95.15 Access, retention and cost guardrails
Story (fictional teaching scenario). At a fictional Jaipur firm, Elena from Berlin needs a short incident investigation, not access to every team’s historical logs.
Why
Logs are sensitive operational data, and indefinite collection can increase exposure and cost.
What
- RBAC means role-based access control: permissions follow reviewed roles.
- Least privilege grants only the required log scope and operations.
- A retention policy determines when stored records are eligible for removal, subject to obligations and legal holds.
- Ingestion, storage and query scanning can be separate cost drivers. Rates depend on product, region, class and plan.
- An export creates another copy with its own access/retention requirements.
How
-
Keep access scoped by purpose and separate read from administration.
-
Obtain approval before any retention/access change; none is performed here.
-
Estimate volume and query frequency without inventing a price.
-
Use narrow scopes and avoid unnecessary dashboard refreshes.
-
Retain every existing backup in this course workflow; this lesson is not permission to delete anything.
Example 1: Estimate volume, not a bill
- Read the command or request.
100 events/minute ×60 minutes =6000 events
6000 events ×500 bytes/event =3000000 bytes before storage effects
- Read the result.
Output (illustrative; NOT executed against Loki, Elastic or CloudWatch)
Approximate raw event volume:3 million bytes per hour in this fictional example.
- Line by line: This arithmetic excludes compression, indexing, replication, metadata and product billing rules. It is not a cloud price quote. Standard Logs Insights queries should use narrow groups/time; stop unnecessary running queries and avoid high-frequency dashboard refreshes, as official guidance warns.
Ravindra Bagale's Tip
Retention and access changes need real approval, not a tutorial command.
Retention आणि access बदलायला खरी approval लागते; tutorial command पुरेशी नाही.
Retention और access बदलने के लिए असली approval चाहिए; tutorial command काफी नहीं.
Did you understand? Let us try it once more.