gelf

package module
v0.0.0-...-4ff2e71 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2017 License: MIT Imports: 8 Imported by: 0

README

Graylog GELF Module for Logspout adopted for Kubernetes

This module allows Logspout to send Docker logs in the GELF format to Graylog via UDP.

Build

To build, you'll need to fork Logspout, add the following code to modules.go

_ "github.com/smpio/kube-logspout-gelf"

and run docker build -t $(whoami)/logspout:gelf

Run

docker run \
    -v /var/run/docker.sock:/var/run/docker.sock \
    $(whoami)/logspout:gelf \
    gelf://<graylog_host>:12201

A note about GELF parameters

The following docker container attributes are mapped to the corresponding GELF extra attributes.

{
        "_kube_namespace": <namespace>,
        "_kube_container": <container-name>,
        "host":            <pod-name>,
}

You can also add extra custom fields by setting env vars with prefix KUBE_.

For example by setting KUBE_NODE=node1 will add the extra field _kube_node=node1.

License

MIT. See License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGelfAdapter

func NewGelfAdapter(route *router.Route) (router.LogAdapter, error)

NewGelfAdapter creates a GelfAdapter with UDP as the default transport.

Types

type GelfAdapter

type GelfAdapter struct {
	// contains filtered or unexported fields
}

GelfAdapter is an adapter that streams UDP JSON to Graylog

func (*GelfAdapter) Stream

func (a *GelfAdapter) Stream(logstream chan *router.Message)

Stream implements the router.LogAdapter interface.

type GelfMessage

type GelfMessage struct {
	*router.Message
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL