gelf

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

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

Go to latest
Published: May 19, 2016 License: MIT Imports: 7 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 {
	GraylogEndpoint 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) Send

func (g *Gelf) Send(b []byte) (n int, err error)

func (*Gelf) Write

func (g *Gelf) Write(message []byte) (n int, err error)

Jump to

Keyboard shortcuts

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