syslog-gollector: github.com/otoolep/syslog-gollector/input Index | Files

package input

import "github.com/otoolep/syslog-gollector/input"

Index

Package Files

delimiter.go input.go parser.go

Constants

const (
    SYSLOG_DELIMITER = `<[0-9]{1,3}>[0-9]\s`
)

type Delimiter Uses

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

A Delimiter detects when Syslog lines start.

func NewDelimiter Uses

func NewDelimiter(maxSize int) *Delimiter

NewDelimiter returns an initialized Delimiter.

func (*Delimiter) Push Uses

func (d *Delimiter) Push(b byte) (string, bool)

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

func (*Delimiter) Stream Uses

func (d *Delimiter) Stream(reader Reader) chan string

Stream returns a channel, on which the delimited Syslog messages are emitted.

func (*Delimiter) Vestige Uses

func (d *Delimiter) Vestige() (string, bool)

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

type ParsedMessage Uses

type ParsedMessage struct {
    Priority  int    `json:"priority"`
    Version   int    `json:"version"`
    Timestamp string `json:"timestamp"`
    Host      string `json:"host"`
    App       string `json:"app"`
    Pid       int    `json:"pid"`
    MsgId     string `json:"msgid"`
    Message   string `json:"message"`
}

ParsedMessage represents a fully parsed Syslog message.

type Reader Uses

type Reader interface {
    ReadByte() (byte, error)
}

Reader is the interface objects passed to the Delimiter must support.

type Rfc5424Parser Uses

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

A Rfc5424Parser parses Syslog messages.

func NewRfc5424Parser Uses

func NewRfc5424Parser() *Rfc5424Parser

NewRfc5424Parser Returns an initialized Rfc5424Parser.

func (*Rfc5424Parser) Parse Uses

func (p *Rfc5424Parser) Parse(raw string) *ParsedMessage

Parse takes a raw message and returns a parsed message. If no match, nil is returned.

func (*Rfc5424Parser) Statistics Uses

func (p *Rfc5424Parser) Statistics() (metrics.Registry, error)

Statistics returns an object storing statistics, which supports JSON marshalling.

func (*Rfc5424Parser) StreamingParse Uses

func (p *Rfc5424Parser) StreamingParse(in chan string) (chan string, error)

StreamingParse emits parsed Syslog messages on the returned channel. If there are any parsing errors, the message is dropped.

type TcpServer Uses

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

A TcpServer binds to the supplied interface and receives Syslog messages.

func NewTcpServer Uses

func NewTcpServer(iface string) *TcpServer

NewTcpServer returns a TCP server.

func (*TcpServer) Start Uses

func (s *TcpServer) Start(f func() chan<- string) error

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

func (*TcpServer) Statistics Uses

func (s *TcpServer) Statistics() (metrics.Registry, error)

Statistics returns an object storing statistics, which supports JSON marshalling.

type UdpServer Uses

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

A UdpServer listens to the supplied interface and receives Syslog messages.

func NewUdpServer Uses

func NewUdpServer(iface string) *UdpServer

NewUdpServer returns a UDP server.

func (*UdpServer) Start Uses

func (s *UdpServer) Start(f func() chan<- string) error

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

func (*UdpServer) Statistics Uses

func (s *UdpServer) Statistics() (metrics.Registry, error)

Statistics returns an object storing statistics, which supports JSON marshalling.

Package input imports 10 packages (graph) and is imported by 1 packages. Updated 2017-06-12. Refresh now. Tools for package owners.