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
From the course: Node.js: Debugging and Performance Tuning
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Why and what should I log?6m 26s
-
Problems with Node.js console6m 1s
-
(Locked)
Implementing Express error pages6m 48s
-
(Locked)
Choosing a logging library5m 40s
-
(Locked)
Adding Winston for Node logging4m 41s
-
(Locked)
Request logging with Morgan6m 39s
-
(Locked)
Correlating requests in logs6m 18s
-
(Locked)
Cross-application request correlation5m 32s
-
(Locked)
Challenge: Cross-application request IDs2m 14s
-
(Locked)
Solution: Cross-application request IDs9m 30s
-
(Locked)
-
-
-