winston-transport-datadog
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
Name | Default | Description |
---|---|---|
apiKey |
undefined |
api key from datadog |
host |
'intake.logs.datadoghq.com' |
intake hostname |
port |
10516 |
intake port |
bufferSize |
10000 |
how many messages to buffer before discarding |
reconnectInterval |
10000 |
|
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