juju: github.com/dooferlad/juju/logfwd/syslog Index | Files

package syslog

import "github.com/dooferlad/juju/logfwd/syslog"

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

Index

Package Files

client.go config.go doc.go

Constants

const (
    // TLSPort is the TCP port used for syslog-over-TLS.
    TLSPort = 6514
)

type Client Uses

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 Uses

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

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

func OpenForSender Uses

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 Uses

func (client Client) Close() error

Close closes the client's connection.

func (Client) Send Uses

func (client Client) Send(rec logfwd.Record) error

Send sends the record to the remote syslog host.

type RawConfig Uses

type RawConfig struct {
    // 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

    // ExpectedServerCert is the TLS certificate that the server must
    // use when the client connects.
    ExpectedServerCert string

    // CACert is the CA cert PEM to use for the client cert.
    ClientCACert string

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

    // ClientCert 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 Uses

func (cfg RawConfig) Validate() error

Validate ensures that the config is currently valid.

type Sender Uses

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 Uses

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.

Package syslog imports 14 packages (graph). Updated 2016-11-10. Refresh now. Tools for package owners.