Documentation
¶
Index ¶
- func IsDefined(operatorType string) bool
- func Register(operatorType string, newBuilder func() Builder)
- type BuildContext
- type Builder
- type Config
- type Database
- type Duration
- type Operator
- type PluginConfig
- type PluginParameter
- type PluginRegistry
- func (r PluginRegistry) Add(pluginType string, contents string) error
- func (r PluginRegistry) IsDefined(pluginType string) bool
- func (r PluginRegistry) Load(path string) error
- func (r PluginRegistry) LoadAll(dir string, pattern string) error
- func (r PluginRegistry) Render(pluginType string, params map[string]interface{}) (PluginConfig, error)
- type StubDatabase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BuildContext ¶
type BuildContext struct {
PluginRegistry PluginRegistry
Database Database
Parameters map[string]interface{}
Logger *zap.SugaredLogger
}
BuildContext supplies contextual resources when building an operator.
type Builder ¶
type Builder interface {
ID() string
Type() string
Build(BuildContext) (Operator, error)
SetNamespace(namespace string, exclude ...string)
}
Builder is an entity that can build operators
type Config ¶
type Config struct {
Builder
}
Config is the configuration of an operator
func (Config) MarshalJSON ¶
MarshalJSON will marshal a config to JSON.
func (Config) MarshalYAML ¶
MarshalYAML will marshal a config to YAML.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a config from JSON.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML will unmarshal a config from YAML.
type Database ¶
type Database interface {
Close() error
Sync() error
Update(func(*bbolt.Tx) error) error
View(func(*bbolt.Tx) error) error
}
Database is a database used to save offsets
type Duration ¶
Duration is the representation of a length of time
func (Duration) MarshalJSON ¶
MarshalJSON will marshal the duration as a json string
func (Duration) MarshalYAML ¶
MarshalYAML will marshal the duration as a yaml string
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON will unmarshal json as a duration
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML will unmarshal yaml as a duration
type Operator ¶
type Operator interface {
// ID returns the id of the operator.
ID() string
// Type returns the type of the operator.
Type() string
// Start will start the operator.
Start() error
// Stop will stop the operator.
Stop() error
// CanOutput indicates if the operator will output entries to other operators.
CanOutput() bool
// Outputs returns the list of connected outputs.
Outputs() []Operator
// SetOutputs will set the connected outputs.
SetOutputs([]Operator) error
// CanProcess indicates if the operator will process entries from other operators.
CanProcess() bool
// Process will process an entry from an operator.
Process(context.Context, *entry.Entry) error
// Logger returns the operator's logger
Logger() *zap.SugaredLogger
}
Operator is a log monitoring component.
type PluginConfig ¶
type PluginConfig struct {
Version string
Title string
Description string
Parameters map[string]PluginParameter
Pipeline []Config
}
PluginConfig is the rendered config of a plugin.
type PluginParameter ¶
type PluginParameter struct {
Label string
Description string
Required bool
Type string // "string", "int", "bool", "strings", or "enum"
ValidValues []string `yaml:"valid_values"` // only useable if Type == "enum"
Default interface{} // Must be valid according to Type & ValidValues
}
PluginParameter is a basic description of a plugin's parameter.
type PluginRegistry ¶
PluginRegistry is a registry of plugin templates.
func NewPluginRegistry ¶
func NewPluginRegistry(dir string) (PluginRegistry, error)
NewPluginRegistry creates a new plugin registry from a plugin directory.
func (PluginRegistry) Add ¶
func (r PluginRegistry) Add(pluginType string, contents string) error
Add will add a plugin to the registry.
func (PluginRegistry) IsDefined ¶
func (r PluginRegistry) IsDefined(pluginType string) bool
IsDefined returns a boolean indicating if a plugin is defined and registered.
func (PluginRegistry) Load ¶
func (r PluginRegistry) Load(path string) error
Load will load a plugin template from a file path.
func (PluginRegistry) LoadAll ¶
func (r PluginRegistry) LoadAll(dir string, pattern string) error
LoadAll will load all plugin templates contained in a directory.
func (PluginRegistry) Render ¶
func (r PluginRegistry) Render(pluginType string, params map[string]interface{}) (PluginConfig, error)
Render will render a plugin config using the params and plugin type.
type StubDatabase ¶
type StubDatabase struct{}
StubDatabase is an implementation of Database that succeeds on all calls without persisting anything to disk. This is used when --database is unspecified.
func NewStubDatabase ¶
func NewStubDatabase() *StubDatabase
NewStubDatabase creates a new StubDatabase
func (*StubDatabase) Close ¶
func (d *StubDatabase) Close() error
Close will be ignored by the stub database
func (*StubDatabase) Sync ¶
func (d *StubDatabase) Sync() error
Sync will be ignored by the stub database