What monitoring and logging strategies would you employ in a microservices architecture? How would you centralize logs and metrics for better observability?

Monitoring and logging in a microservices architecture require centralizing logs and metrics from every service into a single place, since a request can span many services and per-service log files alone aren't enough to diagnose issues.

Key Points

Example

When a checkout request fails intermittently, a trace ID in the structured logs lets an engineer pull every log line related to that exact request across the Order, Payment, and Inventory services in Kibana, while a Grafana dashboard shows whether the failures correlate with a spike in database latency.

# Spring Boot 3.4+: structured JSON logs that log platforms can index
logging:
  structured:
    format:
      console: ecs            # Elastic Common Schema (or logstash / gelf)

# Each line is JSON and includes the trace id, so one search finds the
# whole request across services
{"@timestamp":"2026-11-01T07:15:02.311Z","log.level":"ERROR",
 "service.name":"payment-service","message":"Card declined",
 "traceId":"6f1c2a9e7b3d4c10","spanId":"0f9e8d7c6b5a4932"}

# Metrics -> Prometheus + Grafana, traces -> Zipkin or Tempo,
# logs -> ELK or Loki, alerts on error rate and p99 latency

Interview Tip

A concise interview answer is

I'd centralize logs with something like the ELK stack, collect metrics with Prometheus and visualize them in Grafana, and add distributed tracing with Jaeger or Zipkin so a single request can be followed across every service it touches. Structured logging with a shared trace ID is what ties all three together for real observability.

Last updated: 1 November 2026

Previous question: Describe a scenario where a microservice might fail. How would you implement the Circuit Breaker pattern to handle failures and maintain system resilience?

Next question: You notice that one of your microservices is experiencing high load. How would you approach scaling this service, and what factors would you consider in your decision?

More Microservices - Level II interview questions

All Microservices - Level II questions