pinojs/pino-elasticsearch

It not working with nestjs

Closed this issue · 2 comments

 LoggerModule.forRootAsync({
      providers: [ConfigService],
      useFactory: (config: ConfigService) => {
        const streamToElastic = pinoElastic({
          index: 'search-audi-log',
          node: config.get('ES_URL', 'https://localhost:9200'),
          flushBytes: 1000,
          auth: {
            apiKey:
              'ZmZGV0hJd0JISnhuOVB5aTlqUW06djBGM21kWjZRUS1xemZhZGI3QTF4dw==',
          },
          // tls: { rejectUnauthorized: false },
          opType: 'create',
        });

        return {
          pinoHttp: [
            { level: 'info', transport: { target: 'pino-pretty' } },
            streamToElastic,
          ],
        };
      },
      inject: [ConfigService],
    }),

I'm using pino-elastic in my nestjs application.
You should remove param - { transport: { target: 'pino-pretty' } }, or use pinoMultiStream for multi stream

Thanks for reporting. We do not have the resources to support Nest.js users. Please refer to the Nest Discord channel (support) for such questions.