lph
gopkg.in/polds/logrus-papertrail-hook.v2
go get gopkg.in/polds/logrus-papertrail-hook.v2
lph

gopkg.in/polds/logrus-papertrail-hook.v2

Papertrail hook for Logrus - https://github.com/sirupsen/logrus

by Peter Olds

v2.0.0-20151013232512-dfa4a9f9a7b1 (see all)License:MIT
go get gopkg.in/polds/logrus-papertrail-hook.v2
Readme

Papertrail Hook for Logrus :walrus: Build Status godoc reference

Papertrail provides hosted log management. Once stored in Papertrail, you can group your logs on various dimensions, search them, and trigger alerts.

In most deployments, you'll want to send logs to Papertrail via their remote_syslog daemon, which requires no application-specific configuration. This hook is intended for relatively low-volume logging, likely in managed cloud hosting deployments where installing remote_syslog is not possible.

Usage

You can find your Papertrail port(Accepting TCP/TLS, UDP) on your Papertrail account page. Substitute it below for YOUR_PAPERTRAIL_PORT.

For YOUR_APP_NAME and YOUR_HOST_NAME, substitute a short strings that will readily identify your application and server in the logs. If you leave YOUR_HOST_NAME empty, papertrail will replace it with your ip.

import (
  log "github.com/sirupsen/logrus"
  "github.com/polds/logrus-papertrail-hook"
)

func main() {

  hook, err := logrus_papertrail.NewPapertrailHook(&logrus_papertrail.Hook{
    Host: "logs.papertrailapp.com",
    Port: YOUR_PAPERTRAIL_PORT,
    Hostname: YOUR_HOST_NAME,
    Appname: YOUR_APP_NAME
  })

  hook.SetLevels([]log.Level{log.ErrorLevel, log.WarnLevel})

  if err == nil {
    log.AddHook(hook)
  }

  log.Warning("Here is you message")

}

2017-04-13-16 32 29-screenshot

Changelog

GitHub Stars

12

LAST COMMIT

4yrs ago

MAINTAINERS

0

CONTRIBUTORS

5

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
v2.0.0-20151013232512-dfa4a9f9a7b1
2yrs ago
No alternatives found
No tutorials found
Add a tutorial