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

package syslog

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

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


Package Files

client.go config.go doc.go

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(records []logfwd.Record) error

Send sends the record to the remote syslog host.

type RawConfig Uses

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 Uses

func (cfg RawConfig) Validate() error

Validate ensures that the config is currently valid.

type Sender Uses

type Sender interface {

    // 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 12 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.