Skip to content

thomasdseao/go-graylog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

License

Stars

Watchers

Forks

Packages

No packages published

Languages