syslog

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string
	Port int

	Transport Transport
	RFC       RFCMode

	Workers int

	// Facility is 0-23
	Facility int

	AppName  string
	Hostname string
	ProcID   string
	MsgID    string

	// UDP-only safety limit. If <= 0, no truncation is attempted.
	// If positive and message exceeds the limit, it will be truncated.
	MaxDatagramBytes int

	// TCP-only TLS configuration. If nil, TLS is disabled.
	TLSConfig *tls.Config
}

Config controls syslog message formatting and transport behavior.

type RFCMode

type RFCMode string

RFCMode selects the syslog wire format.

const (
	// RFC3164Mode formats messages as RFC 3164.
	RFC3164Mode RFCMode = "3164"
	// RFC5424Mode formats messages as RFC 5424.
	RFC5424Mode RFCMode = "5424"
)

type Syslog

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

Syslog implements output.Output by formatting records as syslog and delegating transport.

func New

func New(logger *zap.Logger, cfg Config) (*Syslog, error)

New creates a Syslog output that delegates to TCP or UDP outputs.

func (*Syslog) Stop

func (s *Syslog) Stop(ctx context.Context) error

Stop delegates to the underlying transport.

func (*Syslog) Write

func (s *Syslog) Write(ctx context.Context, rec output.LogRecord) error

Write formats a record as syslog and delegates to the underlying transport.

type Transport

type Transport string

Transport selects the transport type.

const (
	// TransportTCP sends messages over TCP.
	TransportTCP Transport = "tcp"
	// TransportUDP sends messages over UDP.
	TransportUDP Transport = "udp"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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