0.2.0 • Published 4 years ago

@marfle/winston-transport-datadog v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

winston-transport-datadog

npm (scoped) node (scoped)

winston transport for Datadog logging.

There are couple of winston transports for datadog. This one does buffering, error handling and uses tls-tcp instead of https.

Install

npm install @marfle/winston-transport-datadog

Usage

Use:

const { createLogger } = require('winston');
const { DatadogTransport } = require('@marfle/winston-transport-datadog');

logger = createLogger({
  transports: [
    new DatadogTransport({
      apiKey: '<YOUR API KEY',
      // optional metadata which will be merged with log message
      metadata: {
        environment: process.env.NODE_ENV,
        service: 'myService'
      }
    })
  ]
});

Options

NameDefaultDescription
apiKeyundefinedapi key from datadog
host'intake.logs.datadoghq.com'intake hostname
port10516intake port
bufferSize10000how many messages to buffer before discarding
reconnectInterval10000
socketOptions{ timeout: 10000 }options passed to tls.socket
metadata{ ddsource: 'winston' }optional metadata which will be merged with log message

DatadogTransport extends Transport from winston-transport, so it's options also apply.

License

MIT See LICENSE file.

About us

Marfle makes software for workboat fleets