From the course: Node.js: Debugging and Performance Tuning

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Correlating requests in logs

Correlating requests in logs

From the course: Node.js: Debugging and Performance Tuning

Start my 1-month free trial

Correlating requests in logs

- [Instructor] When logging system activity it's important to be able to relate logging events with the request that triggered them. A single request can create any number of log entries which compounds the problem. How can we correlate requests in logs? The process of tracing a single request, across multiple logs requires a unique identifier that is generated by each request. This unique identifier is commonly known as a request ID. In Express, a request ID can be included as part of the request object. Then, any time a log entry is created, include that unique identifier. Why bother to do this? Here's an example of five log entries that were triggered by three requests, a user was created, there's a failed CAPTCHA, a welcome message was sent, login failed, then succeeded. While these are all important events we can't see what happened as a result of a particular request. Here's that exact same example, but this time with unique request IDs. Instead of having log entries, that lack…

Contents