From the course: DevOps Foundations: Monitoring and Observability

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Log monitoring in action using Loki and Grafana Cloud

Log monitoring in action using Loki and Grafana Cloud

From the course: DevOps Foundations: Monitoring and Observability

Log monitoring in action using Loki and Grafana Cloud

- [Instructor] After learning so much about logging, let's look at Grafana Cloud to see how we can interact with our logs. As usual, we'll take a look at the instrumentation to see how we're making this possible. In my node.js service, I'm making use of the Winston Library to collect my logs. In my Winston config, I'm instantiating a file log on line seven, which is sending my logs to a file name combined.log. I also have functions defined, which receive a message or payload and create a log line, which is then sent to the file. Throughout my service, I'm making use of this config to create my logs. As you'll see in the metrics endpoint on line 40, I have a log response, which sends my response as well as the status code and the payload. In the payload, I'm including the trace ID, which is what will help us link our logs to traces. As we'll see when we get into Grafana. To send my logs to Grafana, we're using the hotel…

Contents