syslog

package
v0.0.0-...-e2451da Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2015 License: MIT Imports: 9 Imported by: 2

Documentation

Overview

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

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type SyslogHandler

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

func New

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

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.

Jump to

Keyboard shortcuts

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