Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Winston transport for Datadog Logs (not events)

License

Notifications You must be signed in to change notification settings

shelfio/winston-datadog-logs-transport

Repository files navigation

winston-datadog-logs-transport

Winston transport for Datadog Logs (not events)

There are 3 winston transports for Datadog on NPM: 1, 2, 3.

All of them send data to Datadog Events instead of Datadog Logs. This package actually is a transport for Datadog Logs, not Events.

Install

$ yarn add @shelf/winston-datadog-logs-transport

Usage

import winston from 'winston';
import DatadogTransport from '@shelf/winston-datadog-logs-transport';

const logger = winston.createLogger({
  transports: [
    new DatadogTransport({
      apiKey: process.env.DD_API_KEY, // Datadog API key
      // optional metadata which will be merged with every log message
      metadata: {
        ddsource: 'lambda',
        environment: 'prod'
      }
    })
  ]
});

logger.info('Hey there', {thisIsMy: 'metadata'});

License

MIT © Shelf