https://github.com/nitro/newrelic-logrus
Logrus logging hook to report errors via New Relic Go agent
https://github.com/nitro/newrelic-logrus
Last synced: about 1 year ago
JSON representation
Logrus logging hook to report errors via New Relic Go agent
- Host: GitHub
- URL: https://github.com/nitro/newrelic-logrus
- Owner: Nitro
- License: mit
- Created: 2017-09-01T13:18:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-05-18T15:12:21.000Z (about 4 years ago)
- Last Synced: 2024-06-20T16:59:57.043Z (almost 2 years ago)
- Language: Go
- Size: 1.95 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
New Relic Logrus Hook
=====================
This is a simple logrus hook that lets existing logrus applications hook into
New Relic error reporting using the New Relic Go Agent.
New Relic relies on having errors associated witha transaction. But logrus
doesn't know which transaction its being called from. So currently this hook
plugin just creates a new transaction called `errorTxn` and reports logged
errors under that transaction. They show up just like any other reported
errors. If any fields are supplied to the log line via `WithFields`, they are
reported as custom attributes on the `errorTxn` and will be visible in New
Relic.
Usage
-----
You can install this like any other logrus hook. Assuming that `application`
is your `newrelic.Application` from the Go agent, you can "hook" it up like
this:
```
log.AddHook(
newrelic_logrus.NewNewRelicLogrusHook(
application,
[]log.Level{log.ErrorLevel, log.FatalLevel},
),
)
```