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.
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 LogSinkSpec ¶
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 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 ¶
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.