0

I set up Grafana and Grafana Loki with my NestJS Backend, which works totally fine. I can get my logs in Grafana. But i also recognized that my NestJS throws a 404 error because the /api/live/ws route is requestet by Grafana.

Is it possible to disable this in Grafana?

Why does Grafana do this?

NestJS Error

exception NotFoundException: Cannot GET /api/live/ws
    at callback (/Users/hraschan/private/gymble-nestjs-backend/node_modules/@nestjs/core/router/routes-resolver.js:77:19)
    at /Users/hraschan/private/gymble-nestjs-backend/node_modules/@nestjs/core/router/router-proxy.js:9:23
    at Layer.handle [as handle_request] (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/index.js:328:13)
    at /Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/index.js:346:12)
    at next (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/index.js:280:10)
    at LoggerMiddleware.use (/Users/hraschan/private/gymble-nestjs-backend/src/core/middleware/logger.middleware.ts:29:5)
    at /Users/hraschan/private/gymble-nestjs-backend/node_modules/@nestjs/core/router/router-proxy.js:9:23
    at Layer.handle [as handle_request] (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/layer.js:95:5) {
  response: {
    statusCode: 404,
    message: 'Cannot GET /api/live/ws',
    error: 'Not Found'
  },
  status: 404,
  options: {}
}

I found that there is feature called Grafana Live which i tried to deactivate in the grafana.ini config. This didn't work sadly.

FYI: I'm using nest-winston for logging in NestJS and winston-loki package for pushing the logs to Grafana Loki.

maxi hraschan
  • 153
  • 12

1 Answers1

0

Should rather go for that format mentioned here: nestjs global inject nestwinston and format

And you could just supply with NestJS the endpoint :D

Was looking at the same library and seen your question.

But decided to go like this: https://www.youtube.com/watch?v=2ESOGJTXv1s

Rabus
  • 81
  • 4