Skip to content

Latest commit

 

History

46 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

godoc license CodeFactor

Go Graylog Package

This package implement Graylog GELF interface to send message using UDP or TCP transport, in Golang.

Example

package main

import (
	"github.com/thomasdseao/go-graylog"
)

func main() {
	// Create Gelf instance
	gelf := graylog.NewGelf(graylog.Config{
		"graylog1.example.com",
		2202,
		graylog.UDP,
		true,
	})
    
	// Create message and JSON encode it
	message := graylog.Message{
		Version:      "1.1",
		Host:         "example.com",
		ShortMessage: "This is the short message",
	}
	jsonMessage, _ := json.Marshal(message)
	
	// Send message
	sent, err := gelf.Send(jsonMessage)

}

Tests

go test

Contribute

Feel free to submit PR with another implementations of Graylog or improvements.

About

Integration of Graylog Extended Log Format (GELF) in Go

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages