Integrating Grafana with Loki for log aggregation in a Node.js application
I've looked through the documentation and I'm still confused about I'm trying to implement Quick question that's been bugging me - I'm currently trying to set up observability for my Node.js application using Grafana and Loki for log aggregation. I've configured my application to send logs directly to Loki, but I keep getting the behavior `"level": "behavior", "msg": "Failed to scrape logs from application, response code: 404"`. I've followed the official documentation but it seems like my log entries are not being recognized. Here's a snippet of my code where I'm using `winston` to send logs to Loki: ```javascript const { createLogger, transports, format } = require('winston'); const LokiTransport = require('winston-loki'); const logger = createLogger({ level: 'info', format: format.json(), transports: [ new LokiTransport({ host: 'http://localhost:3100', labels: { app: 'my-node-app' }, json: true, }) ] }); logger.info('This is a log message'); ``` My Loki instance is up and running, and I've verified that it's accessible at `http://localhost:3100`. However, when I check the logs in Grafana, they don't show up, and I'm concerned that it's a misconfiguration related to the `winston-loki` transport. I also tried using the Loki API directly via curl: ```bash curl -X POST -H "Content-Type: application/json" -d '{"streams": [{"stream": {"app": "my-node-app"}, "values": [["$(date +%s%N)", "This is a test log"]]}]}' http://localhost:3100/loki/api/v1/push ``` This command works, and I can see the log entries in Grafana. Can anyone guide to troubleshoot why the logs from my Node.js application are not being sent to Loki properly? Any advice on how to debug this would be greatly appreciated. This is part of a larger application I'm building. I'd really appreciate any guidance on this. Has anyone else encountered this? I'm working on a desktop app that needs to handle this. I'd really appreciate any guidance on this. Any ideas what could be causing this? I'm working in a Windows 11 environment. Any examples would be super helpful.