syslog

package
v0.0.0-...-200a656 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RFC3164DelimiterPrefix indicates the start of a syslog line
	RFC3164DelimiterPrefix = `<-?[0-9]{1,3}>`
)
View Source
const (
	// RFC5424DelimiterPrefix indicates the start of a syslog line
	RFC5424DelimiterPrefix = `<[0-9]{1,3}>[0-9]\s`
)

Variables

This section is empty.

Functions

func ValidFormat

func ValidFormat(format string) bool

ValidFormat returns if the given format matches one of the possible formats.

Types

type Collector

type Collector interface {
	Start(chan<- *common.Message) error
	Addr() net.Addr
}

Collector specifies the interface all network collectors must implement.

func NewCollector

func NewCollector(proto, iface, format string, tlsConfig *tls.Config) (Collector, error)

NewCollector returns a network collector of the specified type, that will bind to the given inteface on Start(). If config is non-nil, a secure Collector will be returned. Secure Collectors require the protocol be TCP.

type Delimiter

type Delimiter interface {
	Push(b byte) (string, bool)
	Vestige() (string, bool)
}

Delimiter interface

type Parser

type Parser struct {
	Raw    []byte
	Result map[string]interface{}
	// contains filtered or unexported fields
}

A Parser parses the raw input as a map with a timestamp field.

func NewParser

func NewParser(f string) (*Parser, error)

NewParser returns a new Parser instance.

func (*Parser) Parse

func (p *Parser) Parse(b []byte) bool

Parse the given byte slice.

type Pipe

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

Pipe struct

func NewPipe

func NewPipe() *Pipe

NewPipe create a pipe and return

func (*Pipe) Apply

func (p *Pipe) Apply(f filters.Filter) *Pipe

Apply a filter

func (*Pipe) C

func (p *Pipe) C() chan *common.Message

C return pipe channel

func (*Pipe) Open

func (p *Pipe) Open()

Open pipe

func (*Pipe) Register

func (p *Pipe) Register(c consumers.Consumer) *Pipe

Register consumers

type RFC

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

RFC interface

type RFC3164

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

RFC3164 represents a parser for RFC3164-compliant log messages

type RFC3164Delimiter

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

A RFC3164Delimiter detects when Syslog lines start.

func NewRFC3164Delimiter

func NewRFC3164Delimiter(maxSize int) *RFC3164Delimiter

NewRFC3164Delimiter returns an initialized RFC3164Delimiter.

func (*RFC3164Delimiter) Push

func (s *RFC3164Delimiter) Push(b byte) (string, bool)

Push a byte into the RFC3164Delimiter. If the byte results in a a new RFC3164 message, it'll be flagged via the bool.

func (*RFC3164Delimiter) Vestige

func (s *RFC3164Delimiter) Vestige() (string, bool)

Vestige returns the bytes which have been pushed to RFC3164Delimiter, since the last RFC3164 message was returned, but only if the buffer appears to be a valid syslog message.

type RFC5424

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

RFC5424 represents a parser for RFC5424-compliant log messages

type RFC5424Delimiter

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

A RFC5424Delimiter detects when Syslog lines start.

func NewRFC5424Delimiter

func NewRFC5424Delimiter(maxSize int) *RFC5424Delimiter

NewRFC5424Delimiter returns an initialized RFC5424Delimiter.

func (*RFC5424Delimiter) Push

func (s *RFC5424Delimiter) Push(b byte) (string, bool)

Push a byte into the RFC5424Delimiter. If the byte results in a a new Syslog message, it'll be flagged via the bool.

func (*RFC5424Delimiter) Vestige

func (s *RFC5424Delimiter) Vestige() (string, bool)

Vestige returns the bytes which have been pushed to RFC5424Delimiter, since the last Syslog message was returned, but only if the buffer appears to be a valid syslog message.

type TCPCollector

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

TCPCollector represents a network collector that accepts and handler TCP connections.

func (*TCPCollector) Addr

func (s *TCPCollector) Addr() net.Addr

Addr returns the net.Addr that the Collector is bound to, in a race-say manner.

func (*TCPCollector) Start

func (s *TCPCollector) Start(c chan<- *common.Message) error

Start instructs the TCPCollector to bind to the interface and accept connections.

type UDPCollector

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

UDPCollector represents a network collector that accepts UDP packets.

func (*UDPCollector) Addr

func (s *UDPCollector) Addr() net.Addr

Addr returns the net.Addr to which the UDP collector is bound.

func (*UDPCollector) Start

func (s *UDPCollector) Start(c chan<- *common.Message) error

Start instructs the UDPCollector to start reading packets from the interface.

type Unknown

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

Unknown represents a parser for Unknown-compliant log messages

Jump to

Keyboard shortcuts

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