sima-land / logrus-logstash-hook

Golang logrus logstash hook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logstash hook for logrus :walrus:

Based on this hook. But instead of using message context use global 'type' filed for logging

Usage

package main

import (
        "github.com/Sirupsen/logrus"
        "github.com/sima-land/logrus-logstash-hook"
)

func main() {
        log := logrus.New()
        hook, err := logrus_logstash.NewHook("tcp", "172.17.0.2:9999", "myApp")
        if err != nil {
                log.Fatal(err)
        }
        log.Hooks.Add(hook)
        log.Info("Hello") // <-- type "myApp" will be added here for logstash
}

About

Golang logrus logstash hook

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 100.0%