syslog

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

The syslog package holds the tools needed to perform log forwarding from Juju to a remote syslog (RFC 5424) host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Sender is the message sender this client wraps.
	Sender Sender
}

Client is the wrapper around a syslog (RFC 5424) connection.

func Open

func Open(cfg RawConfig) (*Client, error)

Open connects to a remote syslog host and wraps that connection in a new client.

func OpenForSender

func OpenForSender(cfg RawConfig, opener SenderOpener) (*Client, error)

OpenForSender connects to a remote syslog host and wraps that connection in a new client.

func (Client) Close

func (client Client) Close() error

Close closes the client's connection.

func (Client) Send

func (client Client) Send(records []logfwd.Record) error

Send sends the record to the remote syslog host.

type RawConfig

type RawConfig struct {
	// Enabled is true if the log forwarding feature is enabled.
	Enabled bool

	// Host is the host-port of the syslog host. The format is:
	//
	//   [domain-or-ip-addr] or [domain-or-ip-addr][:port]
	//
	// If the port is not set then the default TLS port (6514) will
	// be used.
	Host string

	// CACert is the TLS CA certificate (x.509, PEM-encoded) to use
	// for validating the server certificate when connecting.
	CACert string

	// ClientCert is the TLS certificate (x.509, PEM-encoded) to use
	// when connecting.
	ClientCert string

	// ClientKey is the TLS private key (x.509, PEM-encoded) to use
	// when connecting.
	ClientKey string
}

RawConfig holds the raw configuration data for a connection to a syslog forwarding target.

func (RawConfig) Validate

func (cfg RawConfig) Validate() error

Validate ensures that the config is currently valid.

type Sender

type Sender interface {
	io.Closer

	// Send sends the RFC 5424 message over its connection.
	Send(rfc5424.Message) error
}

Sender exposes the underlying functionality needed by Client.

type SenderOpener

type SenderOpener interface {
	DialFunc(cfg *tls.Config, timeout time.Duration) (rfc5424.DialFunc, error)

	Open(host string, cfg rfc5424.ClientConfig, dial rfc5424.DialFunc) (Sender, error)
}

SenderOpener supports opening a syslog connection.

Jump to

Keyboard shortcuts

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