Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomoat/newrelic-logs
NewRelic logs is a node.js library for send winston logs to newrelic
https://github.com/tomoat/newrelic-logs
Last synced: 6 days ago
JSON representation
NewRelic logs is a node.js library for send winston logs to newrelic
- Host: GitHub
- URL: https://github.com/tomoat/newrelic-logs
- Owner: tomoat
- Created: 2021-11-04T10:56:26.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-11T18:10:01.000Z (over 2 years ago)
- Last Synced: 2024-10-17T12:39:54.667Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Newrelic Logs
NewRelic logs is a NodeJS library for send winston logs to newrelic## Install
```console
$ npm i newrelic-winston-log -S
```
or
```console
$ yarn add newrelic-winston-log
```## Options
- **apiKey**: Your newrelic api key *[required]*
- **appName**: The application name *[required]*
- **level**: The log level of the application or service
- **intakeRegion**: The datadog intake to use. set to `eu` to force logs to be sent to the EU specific intake## Alternatively, you can use environment variable to pass apiKey and appName
## Add Environment Variables```node
process.env.NEW_RELIC_LICENSE_KEY = 'my-key'
process.env.NEW_RELIC_APP_NAME = 'my-app-name'
```## Usage
```javascript
const { createLogger } = require('winston')
const NewrelicTransport = require('newrelic-winston-log')// Create a logger and consume an instance of your transport
const logger = createLogger({
// Whatever options you need
// Refer https://github.com/winstonjs/winston#creating-your-own-logger
// transports: [
// new NewrelicTransport(options),
// ],
})if (process.env.NODE_ENV !== 'production') {
logger.add(
new NewrelicTransport({
apiKey: 'YOUR_NEW_RELIC_LICENSE_KEY',
appName: 'YOUR_APP_NAME',
level: 'info',
})
)
}```