go-syslog: github.com/influxdata/go-syslog Index | Files | Directories

package syslog

import "github.com/influxdata/go-syslog"

Package syslog provides generic interfaces and structs for syslog messages and transport. Subpackages contains various parsers or scanners for different syslog formats.

Index

Package Files

options.go syslog.go

type BestEfforter Uses

type BestEfforter interface {
    WithBestEffort()
    HasBestEffort() bool
}

BestEfforter is an interface that wraps the HasBestEffort method.

type Machine Uses

type Machine interface {
    Parse(input []byte) (Message, error)
    BestEfforter
}

Machine represent a FSM able to parse an entire syslog message and return it in an structured way.

type MachineOption Uses

type MachineOption func(m Machine) Machine

MachineOption represents the type of option setters for Machine instances.

type Message Uses

type Message interface {
    Valid() bool
    Priority() *uint8
    Version() uint16
    Facility() *uint8
    Severity() *uint8
    FacilityMessage() *string
    FacilityLevel() *string
    SeverityMessage() *string
    SeverityLevel() *string
    SeverityShortLevel() *string
    Timestamp() *time.Time
    Hostname() *string
    ProcID() *string
    Appname() *string
    MsgID() *string
    Message() *string
    StructuredData() *map[string]map[string]string
}

Message represent a structured representation of a syslog message.

type Parser Uses

type Parser interface {
    Parse(r io.Reader)
    WithListener(ParserListener)
    BestEfforter
}

Parser is an interface that wraps the Parse method.

type ParserListener Uses

type ParserListener func(*Result)

ParserListener is a function that receives syslog parsing results, one by one.

type ParserOption Uses

type ParserOption func(p Parser) Parser

ParserOption represent the type of option setters for Parser instances.

func WithBestEffort Uses

func WithBestEffort() ParserOption

WithBestEffort returns a generic options that enables best effort mode for syslog parsers.

When passed to a parser it tries to recover as much of the syslog messages as possible.

func WithListener Uses

func WithListener(f ParserListener) ParserOption

WithListener returns a generic option that sets the emit function for syslog parsers.

type Result Uses

type Result struct {
    Message Message
    Error   error
}

Result wraps the outcomes obtained parsing a syslog message.

Directories

PathSynopsis
common
nontransparent
octetcounting
rfc5424
testing

Package syslog imports 2 packages (graph) and is imported by 6 packages. Updated 2019-08-16. Refresh now. Tools for package owners.