gelf

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assemble

func Assemble(chunks <-chan Chunk, maxMessageSize int, assembleTimeout time.Duration) <-chan Chunk

Assemble consumes byte chunks from the input channel, usually passed from UDP server. It feeds de-chunked messages to the result channel.

func Extract

func Extract(encodedMsgs <-chan Chunk, decompressSizeLimit int) <-chan []byte

Extract applies decompression to byte messages if nessessary.

Types

type Assembler

type Assembler struct {
	// contains filtered or unexported fields
}

Assembler provides GELF message de-chunking

func NewAssembler

func NewAssembler(maxMessageSize int, timeout time.Duration) (res *Assembler)

NewAssembler returns empty Assembler with maximum message size and duration specified.

func (*Assembler) Bytes

func (a *Assembler) Bytes() []byte

Bytes returns message bytes, not nessesarily fully assembled

func (*Assembler) Expired

func (a *Assembler) Expired() bool

Expired returns true if first chunk is too old

func (*Assembler) Update

func (a *Assembler) Update(chunk Chunk) bool

Update feeds the byte chunk to Assembler, returns ok when the message is complete.

type Chunk

type Chunk []byte

Chunk represent GELF UDP chunk

func (Chunk) Body

func (c Chunk) Body() []byte

Body returns chunk payload

func (Chunk) Data

func (c Chunk) Data(decompressSizeLimit int) (res []byte, err error)

Data returns appropriately decoded message bytes

func (Chunk) ID

func (c Chunk) ID() string

ID returns chunk ID

func (Chunk) IsGELF

func (c Chunk) IsGELF() bool

IsGELF returns true if the byte chunk starts with the GELF magic sequence

func (Chunk) Sequence

func (c Chunk) Sequence() (number, count int)

Sequence returns chunk sequence number and count

Jump to

Keyboard shortcuts

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