Documentation ¶
Overview ¶
The syslog package provides a syslog client.
Unlike the core log/syslog package it uses the newer rfc5424 syslog protocol, reliably reconnects on failure, and supports TLS encrypted TCP connections.
Index ¶
Constants ¶
const Rfc5424time = "2006-01-02T15:04:05.999999Z07:00"
like time.RFC3339Nano but with a limit of 6 digits in the SECFRAC part
Variables ¶
var ErrPriority = fmt.Errorf("Not a designated priority")
Returned when looking up a non-existant facility or severity
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct { Packets chan Packet Errors chan error ClientHostname string // contains filtered or unexported fields }
A Logger is a connection to a syslog server. It reconnects on error. Clients log by sending a Packet to the logger.Packets channel.
func Dial ¶
func Dial(clientHostname, network, raddr string, rootCAs *x509.CertPool, connectTimeout time.Duration, writeTimeout time.Duration, tcpMaxLineLength int) (*Logger, error)
Dial connects to the syslog server at raddr, using the optional certBundle, and launches a goroutine to watch logger.Packets for messages to log.
type Packet ¶
type Packet struct { Severity Priority `json:"severity"` Facility Priority `json:"facility"` Hostname string `json:"hostname"` Tag string `json:"tag"` Time time.Time `json:"time"` Message string `json:"message"` }
A Packet represents an RFC5425 syslog message
type Priority ¶
type Priority int
A Syslog Priority is a combination of Severity and Facility.
RFC5424 Severities
const ( LogKern Priority = iota LogUser LogMail LogDaemon LogAuth LogSyslog LogLPR LogNews LogUUCP LogCron LogAuthPriv LogFTP LogNTP LogAudit LogAlert LogAt LogLocal0 LogLocal1 LogLocal2 LogLocal3 LogLocal4 LogLocal5 LogLocal6 LogLocal7 )
RFC5424 Facilities