Ravindra BagaleCourses & study guides मराठी

DevOps

Chapter 95: Logging with Loki, Elastic Stack and CloudWatch

Friends, chapter 87 explained monitoring with Prometheus. Today we ask a different question: what happened in one request? Logs are event records, not a replacement for metrics or traces. We will compare three logging systems, read their query languages slowly, and run only a tiny Python lab with invented data. No real log file, cloud account or logging server is needed. Every Loki, Elastic and CloudWatch result is illustrative, not executed.

Classroom safety and route

  1. Learn the shape of one event before collecting millions of lines.
  2. Remove sensitive fields before sending or storing anything.
  3. Learn Loki labels and LogQL, Elastic mappings and queries, then CloudWatch groups and Insights QL.
  4. Practise time conversion, parsing and aggregation on synthetic local data only.
  5. Finish the interview cards and the one chapter quiz.

A CLI is a command-line interface. An API is an application request interface. JSON is structured text containing named fields and values. HTTP is a request/response protocol; GET reads, while POST submits a request. TLS encrypts network traffic. These terms do not grant permission to collect logs or access a real system.

Existing monitoring/project lessons introduce observability tools. This chapter teaches log-event design and querying instead of repeating Prometheus installation. All business stories are fictional. No actual customer, account, credential, production log or personal profile is used. Prices and product licenses are not claimed. Official documentation links opened for this chapter appear at the end.

Concepts in this chapter

  1. 95.1Logs, metrics and traces — three different questions
  2. 95.2One event — timestamp, severity and structured JSON
  3. 95.3The pipeline — agent, collector, storage and query
  4. 95.4Privacy — allowlists, redaction and safe correlation
  5. 95.5Loki — streams, labels and cardinality
  6. 95.6LogQL — selector, line filter and JSON parser
  7. 95.7Ingestion with Alloy — current collector choice
  8. 95.8Elastic Stack — Elasticsearch, Logstash and Kibana
  9. 95.9Elasticsearch — index, mapping, text and keyword
  10. 95.10Kibana KQL versus Elasticsearch Query DSL
  11. 95.11CloudWatch Logs — groups, streams and retention
  12. 95.12Logs Insights QL — fields, filter, stats and time scope
  13. 95.13Time zones, parsing and multiline stack traces
  14. 95.14Correlation, duplicates and event identity
  15. 95.15Access, retention and cost guardrails
  16. 95.16Alert principles — useful signals without sending alerts
  17. 95.17Troubleshooting missing, delayed and duplicate logs
  18. 95.18Comparison — Loki, Elastic Stack and CloudWatch
  19. 95.19Entirely local lab — synthetic Python logging and parsing
  20. 95.20Interview questions, revision and chapter quiz