Skip to content

Commit cc731ef

Browse files
kimneticsDABH
andauthoredFeb 4, 2024
Add winston-newrelic-agent-transport to transport documentation (#2382)
* Add New Relic Agent Transport entry. * Add description of options. * Adjust code example style to better match other transports. Adjust description to match transport repo changes. --------- Co-authored-by: David Hyde <DABH@users.noreply.github.com>
1 parent f077f30 commit cc731ef

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
 

‎docs/transports.md

+23
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ there are additional transports written by
4848
* [Logsene](#logsene-transport) (including Log-Alerts and Anomaly Detection)
4949
* [Logz.io](#logzio-transport)
5050
* [Mail](#mail-transport)
51+
* [New Relic](#new-relic-agent-transport)
5152
* [Papertrail](#papertrail-transport)
5253
* [PostgresQL](#postgresql-transport)
5354
* [Pusher](#pusher-transport)
@@ -639,6 +640,27 @@ The Mail transport uses [node-mail][17] behind the scenes. Options are the foll
639640

640641
*Metadata:* Stringified as JSON in email.
641642

643+
### New Relic Agent Transport
644+
645+
[winston-newrelic-agent-transport][47] is a New Relic transport that leverages the New Relic agent:
646+
647+
``` js
648+
import winston from 'winston'
649+
import NewrelicTransport from 'winston-newrelic-agent-transport'
650+
651+
const logger = winston.createLogger()
652+
653+
const options = {}
654+
logger.add(new NewrelicTransport(options))
655+
```
656+
657+
The New Relic agent typically automatically forwards Winston logs to New Relic when using CommonJS. With CommonJS no additional transport should be needed. However, when using ECMAScript modules, the automatic forwarding of logs can with certain coding patterns not work. If the New Relic agent is not automatically forwarding your logs, this transport provides a solution.
658+
659+
Options:
660+
661+
* __level__ (optional): The Winston logging level to use as the maximum level of messages that the transport will log.
662+
* __rejectCriteria__ (optional): The rejectCriteria option allows you to specify an array of regexes that will be matched against either the Winston info object or log message to determine whether or not a log message should be rejected and not logged to New Relic.
663+
642664
### Papertrail Transport
643665

644666
[winston-papertrail][27] is a Papertrail transport:
@@ -992,3 +1014,4 @@ That's why we say it's a logger for just about everything
9921014
[44]: https://github.com/Quintinity/humio-winston
9931015
[45]: https://github.com/datalust/winston-seq
9941016
[46]: https://github.com/arpad1337/winston-console-transport-in-worker
1017+
[47]: https://github.com/kimnetics/winston-newrelic-agent-transport

0 commit comments

Comments
 (0)