logforwarder

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

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.

Types

type LogForwardConfig

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

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

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

func NewLogForwarder

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

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

func (*LogForwarder) Kill

func (lf *LogForwarder) Kill()

Kill implements Worker.Kill()

func (*LogForwarder) Wait

func (lf *LogForwarder) Wait() error

Wait implements Worker.Wait()

type LogSink

type LogSink struct {
	SendCloser
}

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

func OpenTrackingSink

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

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

LogSinkFn is a function that opens a log sink.

type LogSinkSpec

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

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

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

LogStreamFn is a function that opens a log stream.

type Logger

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

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

type ManifoldConfig

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

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

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

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

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

type TrackingSinkArgs

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

Path Synopsis

Jump to

Keyboard shortcuts

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