Skip to content

[Pino integration] - pino-http logs for sentry not working #17959

@jalbertsr

Description

@jalbertsr

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node - express

SDK Version

@sentry/node: "^10.19.0"

Framework Version

express@4.21.2 pino-http@9.0.0 node@20.17.0

Link to Sentry event

https://swipoo.sentry.io/explore/logs/?environment=production&logsFields=timestamp&logsFields=message&logsSortBys=-timestamp&project=4504836595777537&statsPeriod=7d

Reproduction Example/SDK Setup

instrument.js

import * as Sentry from '@sentry/node';

import { envVariables } from './src/config/envVariables';

Sentry.init({
  dsn: envVariables.SENTRY_DSN,
  enableLogs: true,
  integrations: [Sentry.pinoIntegration()],
  tracesSampleRate: 1,
  environment: envVariables.ENV === 'PROD' ? 'production' : 'development',
});

index.js

import './instrument';
import pino from 'pino-http';
import * as Sentry from '@sentry/node';

const app = express();
app.use(pino());

Steps to Reproduce

  1. Install express CRUD API with pino-http as logger.
  2. Install latest Sentry SDK
  3. No pino logs :(

Expected Result

I expect all logs from pino to show.

Example:

$ node example.js | pino-pretty
[2016-03-31T16:53:21.079Z] INFO (46316 on MBP-di-Matteo): something else
    req: {
      "id": 1,
      "method": "GET",
      "url": "/",
      "headers": {
        "host": "localhost:3000",
        "user-agent": "curl/7.43.0",
        "accept": "*/*"
      },
      "remoteAddress": "::1",
      "remotePort": 64386
    }
[2016-03-31T16:53:21.087Z] INFO (46316 on MBP-di-Matteo): request completed
    res: {
      "statusCode": 200,
      "header": "HTTP/1.1 200 OK\r\nX-Powered-By: restify\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: 11\r\nETag: W/\"b-XrY7u+Ae7tCTyyK7j1rNww\"\r\nDate: Thu, 31 Mar 2016 16:53:21 GMT\r\nConnection: keep-alive\r\n\r\n"
    }
    responseTime: 10
    req: {
      "id": 1,
      "method": "GET",
      "url": "/",
      "headers": {
        "host": "localhost:3000",
        "user-agent": "curl/7.43.0",
        "accept": "*/*"
      },
      "remoteAddress": "::1",
      "remotePort": 64386
    }

Actual Result

Only logs done via Sentry.logger.info("Hello world") show,

Additional Context

No response

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

Status

Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions