syslog

package
v0.0.0-...-8d17986 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Rfc5424Format is the modern syslog protocol format. https://tools.ietf.org/html/rfc5424
	Rfc5424Format Format = "rfc5424"
	// Rfc3164Format is the legacy BSD syslog protocol format. https://tools.ietf.org/html/rfc3164
	Rfc3164Format Format = "rfc3164"

	// TraditionalTCPFraming is the traditional LF framing of syslog messages on the wire
	TraditionalTCPFraming TCPFraming = "traditional"
	// OctetCountedTCPFraming prepends the size of each message before the message. https://tools.ietf.org/html/rfc6587#section-3.4.1
	OctetCountedTCPFraming TCPFraming = "octet-counted"
)

Variables

This section is empty.

Functions

func NewSyslogAdapter

func NewSyslogAdapter(route *router.Route) (router.LogAdapter, error)

NewSyslogAdapter returnas a configured syslog.Adapter

Types

type Adapter

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

Adapter streams log output to a connection in the Syslog format

func (*Adapter) Stream

func (a *Adapter) Stream(logstream chan *router.Message)

Stream sends log data to a connection

type FieldTemplates

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

FieldTemplates for rendering Syslog messages

type Format

type Format string

Format represents the RFC spec to use for syslog messages

type Message

type Message struct {
	*router.Message
}

Message extends router.Message for the syslog standard

func (*Message) ContainerName

func (m *Message) ContainerName() string

ContainerName returns the message's container name

func (*Message) ContainerNameSplitN

func (m *Message) ContainerNameSplitN(sep string, n int) []string

ContainerNameSplitN returns the message's container name sliced at most "n" times using "sep"

func (*Message) Hostname

func (m *Message) Hostname() string

Hostname returns the os hostname

func (*Message) Priority

func (m *Message) Priority() syslog.Priority

Priority returns a syslog.Priority based on the message source

func (*Message) Render

func (m *Message) Render(format Format, tmpl *FieldTemplates) ([]byte, error)

Render transforms the log message using the Syslog template

func (*Message) Timestamp

func (m *Message) Timestamp() string

Timestamp returns the message's syslog formatted timestamp

type TCPFraming

type TCPFraming string

TCPFraming represents the type of framing to use for syslog messages

Jump to

Keyboard shortcuts

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