GRAYLOG - Chapter 4, Exercise 2 Solution ========================================================== requestId vs. correlationId: A Difference in Scope PROBLEM ------- Explain, using this chapter's own material, the real difference in scope between requestId and correlationId - which one is broader, and what real example does this chapter give for when the broader one is actually needed? SOLUTION -------- This chapter established that requestId (along with restRequestId and messageRequestId) correlates log lines produced while handling ONE single HTTP request. correlationId operates "one level up" from that - it correlates one item or job as it moves through CROSS-SERVICE steps, which can span multiple separate requests, not just one. correlationId is therefore the BROADER of the two fields - a single job tracked by one correlationId could genuinely involve several different requestId values along the way, one per request-shaped step. The chapter's own real example of when the broader field is needed: a Flux pipeline run that touches several distinct services in sequence - correlationId is what ties that whole multi-step job together, where requestId alone would only show one piece of it. ANSWER: correlationId is broader than requestId - it correlates a whole cross-service job (potentially spanning multiple requests), while requestId only correlates the log lines from a single HTTP request. The chapter's own real example for needing the broader field is a Flux pipeline run spanning several services. ---- WHY THIS WORKS AS AN ANSWER This is a direct restatement of the chapter's own explicit scope comparison, using its own real Flux example rather than inventing a new one. The practical lesson: if a requestId-scoped search feels like it's only showing part of the picture for a multi-step job, correlationId is the field to reach for next, since it operates at genuinely the right scope for that broader question.