gelf

package module
v0.0.0-...-3577785 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2018 License: MIT Imports: 10 Imported by: 0

README

Build Status

graylog-golang

graylog-golang is a full implementation for sending messages in GELF (Graylog Extended Log Format) from Go (Golang) to Graylog

Example

package main

import (
  "github.com/robertkowalski/graylog-golang"
)

func main() {

  g := gelf.New(gelf.Config{})

  g.Log(`{
      "version": "1.0",
      "host": "localhost",
      "timestamp": 1356262644,
      "facility": "Google Go",
      "short_message": "Hello From Golang!"
  }`)
}

Setting Config Values

g := gelf.New(gelf.Config{
  GraylogPort:     80,
  GraylogHostname: "example.com",
  Connection:      "wan",
  MaxChunkSizeWan: 42,
  MaxChunkSizeLan: 1337,
})

Tests

go test

Benchmarks

go test --bench=".*"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	GraylogPort     int
	GraylogHostname string
	Connection      string
	MaxChunkSizeWan int
	MaxChunkSizeLan int
}

type Gelf

type Gelf struct {
	Config
}

func New

func New(config Config) *Gelf

func (*Gelf) Compress

func (g *Gelf) Compress(b []byte) bytes.Buffer

func (*Gelf) CreateChunkedMessage

func (g *Gelf) CreateChunkedMessage(index int, chunkCountInt int, id []byte, compressed *bytes.Buffer) bytes.Buffer

func (*Gelf) GetChunksize

func (g *Gelf) GetChunksize() int

func (*Gelf) IntToBytes

func (g *Gelf) IntToBytes(i int) []byte

func (*Gelf) Log

func (g *Gelf) Log(message string)

func (*Gelf) ParseJson

func (g *Gelf) ParseJson(msg string) map[string]interface{}

func (*Gelf) Send

func (g *Gelf) Send(b []byte)

func (*Gelf) TestForForbiddenValues

func (g *Gelf) TestForForbiddenValues(gmap map[string]interface{}) error

Jump to

Keyboard shortcuts

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