juju: github.com/juju/juju/worker/logforwarder Index | Files | Directories

package logforwarder

import "github.com/juju/juju/worker/logforwarder"

Index

Package Files

logforwarder.go manifold.go orchestrator.go sink.go tracker.go

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs a log forwarding worker, using the resource names defined in the supplied config.

type LogForwardConfig Uses

type LogForwardConfig interface {
    // WatchForLogForwardConfigChanges return a NotifyWatcher waiting for the
    // log forward configuration to change.
    WatchForLogForwardConfigChanges() (watcher.NotifyWatcher, error)

    // LogForwardConfig returns the current log forward configuration.
    LogForwardConfig() (*syslog.RawConfig, bool, error)
}

LogForwardConfig provides access to the log forwarding config for a model.

type LogForwarder Uses

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

LogForwarder is a worker that forwards log records from a source to a sender.

func NewLogForwarder Uses

func NewLogForwarder(args OpenLogForwarderArgs) (*LogForwarder, error)

NewLogForwarder returns a worker that forwards logs received from the stream to the sender.

func (*LogForwarder) Kill Uses

func (lf *LogForwarder) Kill()

Kill implements Worker.Kill()

func (*LogForwarder) Wait Uses

func (lf *LogForwarder) Wait() error

Wait implements Worker.Wait()

type LogSink Uses

type LogSink struct {
    SendCloser
}

LogSink is a single log sink, to which log records may be sent.

func OpenTrackingSink Uses

func OpenTrackingSink(args TrackingSinkArgs) (*LogSink, error)

OpenTrackingSink opens a log record sender to use with a worker. The sender also tracks records that were successfully sent.

type LogSinkFn Uses

type LogSinkFn func(cfg *syslog.RawConfig) (*LogSink, error)

LogSinkFn is a function that opens a log sink.

type LogSinkSpec Uses

type LogSinkSpec struct {
    // Name is the name of the log sink.
    Name string

    // OpenFn is a function that opens a log sink.
    OpenFn LogSinkFn
}

type LogStream Uses

type LogStream interface {
    // Next returns the next batch of log records from the stream.
    Next() ([]logfwd.Record, error)
}

LogStream streams log entries from a log source (e.g. the Juju controller).

type LogStreamFn Uses

type LogStreamFn func(_ base.APICaller, _ params.LogStreamConfig, controllerUUID string) (LogStream, error)

LogStreamFn is a function that opens a log stream.

type Logger Uses

type Logger interface {
    Infof(string, ...interface{})
    Errorf(string, ...interface{})
}

Logger represents the methods used by the worker to log details.

type ManifoldConfig Uses

type ManifoldConfig struct {
    // These are the dependency resource names.
    APICallerName string

    // Sinks are the named functions that opens the underlying log sinks
    // to which log records will be forwarded.
    Sinks []LogSinkSpec

    // OpenLogStream is the function that will be used to for the
    // log stream.
    OpenLogStream LogStreamFn

    // OpenLogForwarder opens each log forwarder that will be used.
    OpenLogForwarder func(OpenLogForwarderArgs) (*LogForwarder, error)

    Logger Logger
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

type OpenLogForwarderArgs Uses

type OpenLogForwarderArgs struct {
    // ControllerUUID identifies the controller.
    ControllerUUID string

    // LogForwardConfig is the API used to access log forwarding config.
    LogForwardConfig LogForwardConfig

    // Caller is the API caller that will be used.
    Caller base.APICaller

    // Name is the name given to the log sink.
    Name string

    // OpenSink is the function that opens the underlying log sink that
    // will be wrapped.
    OpenSink LogSinkFn

    // OpenLogStream is the function that will be used to for the
    // log stream.
    OpenLogStream LogStreamFn

    Logger Logger
}

OpenLogForwarderArgs holds the info needed to open a LogForwarder.

type OrchestratorArgs Uses

type OrchestratorArgs struct {
    // ControllerUUID is the UUID of the controller for which we will forward logs.
    ControllerUUID string

    // LogForwardConfig is the API used to access log forward config.
    LogForwardConfig LogForwardConfig

    // Caller is the API caller that will be used.
    Caller base.APICaller

    // Sinks are the named functions that open the underlying log sinks
    // to which log records will be forwarded.
    Sinks []LogSinkSpec

    // OpenLogStream is the function that will be used to for the
    // log stream.
    OpenLogStream LogStreamFn

    // OpenLogForwarder opens each log forwarder that will be used.
    OpenLogForwarder func(OpenLogForwarderArgs) (*LogForwarder, error)

    Logger Logger
}

OrchestratorArgs holds the info needed to open a log forwarding orchestration worker.

type SendCloser Uses

type SendCloser interface {
    io.Closer
    // contains filtered or unexported methods
}

SendCloser is responsible for sending log records to a log sink.

type TrackingSinkArgs Uses

type TrackingSinkArgs struct {
    // Config is the logging config that will be used.
    Config *syslog.RawConfig

    // Caller is the API caller that will be used.
    Caller base.APICaller

    // Name is the name given to the log sink.
    Name string

    // OpenSink is the function that opens the underlying log sink that
    // will be wrapped.
    OpenSink LogSinkFn
}

TrackingSinkArgs holds the args to OpenTrackingSender.

Directories

PathSynopsis
sinks

Package logforwarder imports 16 packages (graph) and is imported by 33 packages. Updated 2019-10-19. Refresh now. Tools for package owners.