Skip to content

toorop/logrusOVH

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OVH "paas logs" hook for logrus GoDoc Go Report Card

Use this hook to send your Logrus logs to OVH "Logs Data Platform"

Installation

go get github.com/toorop/logrusOVH

Usage

GELF

import (
  "github.com/Sirupsen/logrus"
  "github.com/toorop/logrusOVH"
)
hook, err := NewOvhHook("ENDPOINT","YOUR OVH TOKEN", GELFTCP)
if err != nil {
    panic( err)
}
hook.SetCompression(COMPRESSNONE)
log := logrus.New()
log.Out = ioutil.Discard
log.Hooks.Add(hook)
log.WithFields(logrus.Fields{"msgid": "mymsgID", "intField": 1, "T": "TestGelfTCP"}).Error(msg)

GELF + GZIP + UDP

import (
    "github.com/Sirupsen/logrus"
    "github.com/toorop/logrusOVH"
)
hook, err := NewOvhHook("ENDPOINT","YOUR OVH TOKEN", GELFUDP)
if err != nil {
    panic( err)
}
hook.SetCompression(COMPRESSGZIP)
log := logrus.New()
log.Out = ioutil.Discard
log.Hooks.Add(hook)
log.WithFields(logrus.Fields{"msgid": "mymsgID", "intField": 1, "T": "GELF + GZIP + UDP"}).Error(msg)

Cap'n Proto + TLS

import (
  "github.com/Sirupsen/logrus"
  "github.com/toorop/logrusOVH"
)
hook, err := NewOvhHook("ENDPOINT","YOUR OVH TOKEN", CAPNPROTOTLS)
if err != nil {
    panic( err)
}
hook.SetCompression(COMPRESSNONE)
log := logrus.New()
log.Out = ioutil.Discard
log.Hooks.Add(hook)
log.WithFields(logrus.Fields{"msgid": "mymsgID", "intField": 1, "T": "TestGelfTCP"}).Error(msg)

async

Just use:

hook, err := NewAsyncOvhHook("ENDPOINT","YOUR OVH TOKEN", CAPNPROTOTLS)

Available serialisations, transport

  • GELFTCP: Gelf serialisation & TCP transport
  • GELFUDP: Gelf serialisation & UDP transport
  • GELFTLS: Gelf serialisation & TCP/TLS transport
  • CAPNPROTOTCP: Cap'n proto serialisation & TCP transport
  • CAPNPROTOTLS: Cap'n proto serialisation & TCP/TLS transport

Available compression

  • COMPRESSNONE: no compression (default)
  • COMPRESSGZIP: GZIP compression for GELF
  • COMPRESSZLIB ZLIB compression for GELF
  • COMPRESSPACKNPPACKED: cap'n proto packed (not working yet)

About

OVH logs PAAS Hook for Logrus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published