Ravindra BagaleCourses & study guides मराठी

Chapter 95: Logging with Loki, Elastic Stack and CloudWatch

DevOps

95.1 Logs, metrics and traces — three different questions

Story (fictional teaching scenario). At a fictional Pune bakery, Priya and Daniel from Lisbon see failed orders. A count tells them how often; a log explains one failure; a trace shows where the request travelled.

Logs, metrics and traces — three different questions
Logs, metrics and traces — three different questions

Why

Choosing the right signal stops us from searching every line when one simple measurement answers the question.

What

  • A log records an event, usually with a timestamp and context.
  • A metric is a numeric measurement over time, such as error count or latency.
  • A trace follows one operation through related steps; a span represents one timed step within it.
  • Observability means using signals to understand system behaviour, not merely storing more data.

How

  1. Ask whether you need an individual event, an aggregate trend or a request path.

  2. Use a metric to notice a pattern.

  3. Use selected logs and traces to investigate, with permission.

Example 1: One incident, three views

  1. Read the command or request.
Metric: 2 failed requests out of 6
Log: request req-demo-003 returned status 500
Trace: API span -> worker span
  1. Read the result.

Output (illustrative; NOT executed against Loki, Elastic or CloudWatch)

The metric gives a rate; the event gives context; the trace connects steps.
  1. Line by line: The metric denominator matters. The log describes one invented event. The arrows describe a request path, not proof that a tracing platform was deployed. A trace ID can correlate records, but it must not be used as a secret or proof of identity.

Ravindra Bagale's Tip

More logs do not automatically mean better observability.

Did you understand? Let us try it once more.