rfc3164

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMachine

func NewMachine(options ...syslog.MachineOption) syslog.Machine

NewMachine creates a new FSM able to parse RFC3164 syslog messages.

func NewParser

func NewParser(options ...syslog.MachineOption) syslog.Machine

NewParser creates a syslog.Machine that parses RFC3164 syslog messages.

func WithBestEffort

func WithBestEffort() syslog.MachineOption

WithBestEffort enables the best effort mode.

func WithLocaleTimezone

func WithLocaleTimezone(loc *time.Location) syslog.MachineOption

WithLocaleTimezone sets the strategy to decide the timezone to apply to the Stamp timestamp of RFC 3164.

func WithParseYear

func WithParseYear() syslog.MachineOption

func WithRFC3339

func WithRFC3339() syslog.MachineOption

WithRFC3339 tells the parser to look for RFC3339 timestamps, too.

It tells the parser to accept also RFC3339 timestamps even if they are not in the RFC3164 timestamp part. Note that WithYear option will be ignored when an RFC3339 timestamp will match.

func WithTimezone

func WithTimezone(loc *time.Location) syslog.MachineOption

WithTimezone sets the strategy to decide the timezone to apply to the Stamp timestamp of RFC 3164.

func WithYear

func WithYear(o YearOperator) syslog.MachineOption

WithYear sets the strategy to decide the year for the Stamp timestamp of RFC 3164.

Types

type CurrentYear

type CurrentYear struct{}

CurrentYear is a strategy to obtain the current year in RFC 3164 syslog messages.

func (CurrentYear) Apply

func (CurrentYear) Apply() int

Apply gets the current year

type SyslogMessage

type SyslogMessage struct {
	syslog.Base
}

SyslogMessage represents a RFC3164 syslog message.

type Year

type Year struct {
	YYYY int
}

Year is a strategy to obtain the specified year in the RFC 3164 syslog messages.

func (Year) Apply

func (y Year) Apply() int

Apply gets the specified year

type YearOperation

type YearOperation struct {
	Operator YearOperator
}

YearOperation represents the operation to perform to obtain the year depending on the inner operator/strategy.

func (YearOperation) Operate

func (y YearOperation) Operate() int

Operate gets the year depending on the current strategy.

type YearOperator

type YearOperator interface {
	Apply() int
}

YearOperator is an interface that the operation inferring the year have to implement.

Jump to

Keyboard shortcuts

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