sawmill: github.com/phemmer/sawmill/handler/syslog Index | Files

package syslog

import "github.com/phemmer/sawmill/handler/syslog"

The syslog package is an event handler responsible for sending events to syslog.

Index

Package Files

syslog.go

Constants

const (
    EMERG level = iota
    ALERT
    CRIT
    ERR
    WARN
    NOTICE
    INFO
    DEBUG
)
const (
    KERN facility = iota << 3
    USER
    MAIL
    DAEMON
    AUTH
    SYSLOG
    LPR
    NEWS
    UUCP
    CRON
    AUTHPRIV
    FTP
    LOCAL0
    LOCAL1
    LOCAL2
    LOCAL3
    LOCAL4
    LOCAL5
    LOCAL6
    LOCAL7
)

type SyslogHandler Uses

type SyslogHandler struct {
    Template *template.Template
    // contains filtered or unexported fields
}

func New Uses

func New(protocol string, addr string, facility facility, templateString string) (*SyslogHandler, error)

New attempts to connect to syslog, and returns a new SyslogHandler if successful.

protocol is a "network" as defined by the net package. Commonly either "unix" or "unixgram". See net.Dial for available values. Defaults to "unix" if emtpy.

addr is the address where to reach the syslog daemon. Also see net.Dial. If empty, "/dev/log", "/var/run/syslog", and "/var/run/log" are tried.

facility is the syslog facility to use for all events processed through this handler. Defaults to USER.

templateString is the sawmill/event/formatter compatable template to use for formatting events. Defaults to formatter.SIMPLE_FORMAT.

func (*SyslogHandler) Event Uses

func (sw *SyslogHandler) Event(logEvent *event.Event) error

Event accepts an event and writes it out to the syslog daemon. If the connection was lost, the function will attempt to reconnect once.

Package syslog imports 9 packages (graph) and is imported by 3 packages. Updated 2019-08-09. Refresh now. Tools for package owners.