Ravindra BagaleCourses & study guides मराठी

Chapter 95: Logging with Loki, Elastic Stack and CloudWatch

DevOps

95.14 Correlation, duplicates and event identity

Story (fictional teaching scenario). At a fictional Nagpur team, Arjun and Amira from Rabat see one line twice after a collector restart. They distinguish duplicate delivery from two genuine attempts.

Correlation, duplicates and event identity
Correlation, duplicates and event identity

Why

Counting every delivered row as a unique business event can inflate error rates.

What

  • At-least-once delivery can deliver an event more than once.
  • A duplicate is a repeated representation of the same intended event.
  • Deduplication removes repeats according to an explicit identity rule.
  • An event ID identifies one event; a request/correlation ID can cover many different events.
  • A retry attempt may be a genuine new event even when its request ID is unchanged.

How

  1. Check collector checkpoints and delivery acknowledgement behaviour.

  2. Use a well-defined event identity when exact counts matter.

  3. Do not deduplicate every record sharing a request ID.

  4. Document whether an error chart counts events, requests or attempts.

Example 1: Two cases with one request ID

  1. Read the command or request.
req-demo-003: attempt 1 failed
req-demo-003: attempt 2 succeeded
req-demo-003: attempt 1 failed delivered again
  1. Read the result.

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

Two actual attempts, three deliveries; blindly keeping one request row loses information.
  1. Line by line: The first two are different events. The third repeats the first in this story. The Python lab later uses a simplified timestamp/request/status tuple only for its fixture. That tuple is NOT a universal event-identity guarantee.

Ravindra Bagale's Tip

A request ID is not automatically a unique event ID.

Did you understand? Let us try it once more.