Use this hook to send your Logrus logs to OVH "Logs Data Platform"
go get github.com/toorop/logrusOVH
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)
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)
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)
Just use:
hook, err := NewAsyncOvhHook("ENDPOINT","YOUR OVH TOKEN", CAPNPROTOTLS)
- 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
- COMPRESSNONE: no compression (default)
- COMPRESSGZIP: GZIP compression for GELF
- COMPRESSZLIB ZLIB compression for GELF
- COMPRESSPACKNPPACKED: cap'n proto packed (not working yet)