gelf

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

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

README

zap-gelf

A zap plugin support GELF format send logs to Graylog server over UDP, TCP, HTTP

Documentation

Index

Constants

View Source
const (
	// CompressionNone don't use compression.
	CompressionNone = 0

	// CompressionGzip use gzip compression.
	CompressionGzip = 1

	// CompressionZlib use zlib compression.
	CompressionZlib = 2
)
View Source
const (
	// MinChunkSize minimal chunk size in bytes.
	MinChunkSize = 512

	// MaxChunkSize maximal chunk size in bytes.
	// See https://docs.graylog.org/en/3.2/pages/gelf.html#chunking.
	MaxChunkSize = 8192

	// MaxChunkCount maximal chunk per message count.
	// See https://docs.graylog.org/en/3.2/pages/gelf.html#chunking.
	MaxChunkCount = 128

	// DefaultChunkSize is default WAN chunk size.
	DefaultChunkSize = 1420
)

Variables

View Source
var (
	// ErrChunkTooSmall triggered when chunk size to small.
	ErrChunkTooSmall = errors.New("chunk size too small")

	// ErrChunkTooLarge triggered when chunk size too large.
	ErrChunkTooLarge = errors.New("chunk size too large")

	// ErrUnknownCompressionType triggered when passed invalid compression type.
	ErrUnknownCompressionType = errors.New("unknown compression type")
)

Functions

func NewHttpCore

func NewHttpCore(options ...Option) (_ zapcore.Core, err error)

NewCore zap core constructor.

func NewTcpCore

func NewTcpCore(options ...Option) (_ zapcore.Core, err error)

NewCore zap core constructor.

func NewUdpCore

func NewUdpCore(options ...Option) (_ zapcore.Core, err error)

NewCore zap core constructor.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option interface.

func Address

func Address(value string) Option

Address set Graylog server address.

func CallerKey

func CallerKey(value string) Option

CallerKey set zapcore.EncoderConfig CallerKey property.

func ChunkSize

func ChunkSize(value int) Option

ChunkSize set GELF chunk size.

func CompressionLevel

func CompressionLevel(value int) Option

CompressionLevel set GELF compression level.

func CompressionType

func CompressionType(value int) Option

CompressionType set GELF compression type.

func EncodeCaller

func EncodeCaller(value zapcore.CallerEncoder) Option

EncodeCaller set zapcore.EncoderConfig EncodeCaller property.

func EncodeDuration

func EncodeDuration(value zapcore.DurationEncoder) Option

EncodeDuration set zapcore.EncoderConfig EncodeDuration property.

func EncodeName

func EncodeName(value zapcore.NameEncoder) Option

EncodeName set zapcore.EncoderConfig EncodeName property.

func Host

func Host(value string) Option

Host set GELF host.

func Level

func Level(value zapcore.Level) Option

Level set logging level.

func LevelString

func LevelString(value string) Option

LevelString set logging level.

func LineEnding

func LineEnding(value string) Option

LineEnding set zapcore.EncoderConfig LineEnding property.

func NameKey

func NameKey(value string) Option

NameKey set zapcore.EncoderConfig NameKey property.

func Version

func Version(value string) Option

Version set GELF version.

Jump to

Keyboard shortcuts

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