go-syslog.v2: gopkg.in/mcuadros/go-syslog.v2 Index | Files | Directories

package syslog

import "gopkg.in/mcuadros/go-syslog.v2"

Syslog server library for go, build easy your custom syslog server over UDP, TCP or Unix sockets using RFC3164, RFC5424 and RFC6587

Index

Package Files

doc.go handler.go server.go

Variables

var (
    RFC3164   = &format.RFC3164{}   // RFC3164: http://www.ietf.org/rfc/rfc3164.txt
    RFC5424   = &format.RFC5424{}   // RFC5424: http://www.ietf.org/rfc/rfc5424.txt
    RFC6587   = &format.RFC6587{}   // RFC6587: http://www.ietf.org/rfc/rfc6587.txt - octet counting variant
    Automatic = &format.Automatic{} // Automatically identify the format
)

type ChannelHandler Uses

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

The ChannelHandler will send all the syslog entries into the given channel

func NewChannelHandler Uses

func NewChannelHandler(channel LogPartsChannel) *ChannelHandler

NewChannelHandler returns a new ChannelHandler

func (*ChannelHandler) Handle Uses

func (h *ChannelHandler) Handle(logParts format.LogParts, messageLength int64, err error)

Syslog entry receiver

func (*ChannelHandler) SetChannel Uses

func (h *ChannelHandler) SetChannel(channel LogPartsChannel)

The channel to be used

type DatagramMessage Uses

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

type Handler Uses

type Handler interface {
    Handle(format.LogParts, int64, error)
}

The handler receive every syslog entry at Handle method

type LogPartsChannel Uses

type LogPartsChannel chan format.LogParts

type ScanCloser Uses

type ScanCloser struct {
    *bufio.Scanner
    // contains filtered or unexported fields
}

type Server Uses

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

func NewServer Uses

func NewServer() *Server

NewServer returns a new Server

func (*Server) Boot Uses

func (s *Server) Boot() error

Starts the server, all the go routines goes to live

func (*Server) GetLastError Uses

func (s *Server) GetLastError() error

Returns the last error

func (*Server) Kill Uses

func (s *Server) Kill() error

Kill the server

func (*Server) ListenTCP Uses

func (s *Server) ListenTCP(addr string) error

Configure the server for listen on a TCP addr

func (*Server) ListenTCPTLS Uses

func (s *Server) ListenTCPTLS(addr string, config *tls.Config) error

Configure the server for listen on a TCP addr for TLS

func (*Server) ListenUDP Uses

func (s *Server) ListenUDP(addr string) error

Configure the server for listen on an UDP addr

func (*Server) ListenUnixgram Uses

func (s *Server) ListenUnixgram(addr string) error

Configure the server for listen on an unix socket

func (*Server) SetFormat Uses

func (s *Server) SetFormat(f format.Format)

Sets the syslog format (RFC3164 or RFC5424 or RFC6587)

func (*Server) SetHandler Uses

func (s *Server) SetHandler(handler Handler)

Sets the handler, this handler with receive every syslog entry

func (*Server) SetTimeout Uses

func (s *Server) SetTimeout(millseconds int64)

Sets the connection timeout for TCP connections, in milliseconds

func (*Server) SetTlsPeerNameFunc Uses

func (s *Server) SetTlsPeerNameFunc(tlsPeerNameFunc TlsPeerNameFunc)

Set the function that extracts a TLS peer name from the TLS connection

func (*Server) Wait Uses

func (s *Server) Wait()

Waits until the server stops

type TimeoutCloser Uses

type TimeoutCloser interface {
    Close() error
    SetReadDeadline(t time.Time) error
}

type TlsPeerNameFunc Uses

type TlsPeerNameFunc func(tlsConn *tls.Conn) (tlsPeer string, ok bool)

A function type which gets the TLS peer name from the connection. Can return ok=false to terminate the connection

Directories

PathSynopsis
example
format
internal/syslogparser
internal/syslogparser/rfc3164
internal/syslogparser/rfc5424

Package syslog imports 8 packages (graph) and is imported by 39 packages. Updated 2019-08-17. Refresh now. Tools for package owners.