Documentation ¶
Index ¶
- Variables
- func ReflectConfig(confraw *ConfigRaw, conf interface{}) (err error)
- func RegistFilterHandler(name string, handler FilterHandler)
- func RegistInputHandler(name string, handler InputHandler)
- func RegistOutputHandler(name string, handler OutputHandler)
- type CommonConfig
- type Config
- type ConfigRaw
- type FilterConfig
- type FilterHandler
- type InputConfig
- type InputHandler
- type MsgChan
- type OutputConfig
- type OutputHandler
- type TypeCommonConfig
- type TypeFilterConfig
- type TypeInputConfig
- type TypeOutputConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrorReadConfigFile1 = errutil.NewFactory("Failed to read config file: %q") ErrorUnmarshalJSONConfig = errutil.NewFactory("Failed unmarshalling config in JSON format") ErrorUnmarshalYAMLConfig = errutil.NewFactory("Failed unmarshalling config in YAML format") ErrorTimeout1 = errutil.NewFactory("timeout: %v") )
errors
var ( ErrorUnknownFilterType1 = errutil.NewFactory("unknown filter config type: %q") ErrorInitFilterFailed1 = errutil.NewFactory("initialize filter module failed: %v") )
errors
var ( ErrorUnknownInputType1 = errutil.NewFactory("unknown input config type: %q") ErrorInitInputFailed1 = errutil.NewFactory("initialize input module failed: %v") )
errors
var ( ErrorUnknownOutputType1 = errutil.NewFactory("unknown output config type: %q") ErrorInitOutputFailed1 = errutil.NewFactory("initialize output module failed: %v") )
errors
var ( // Logger app logger Logger = logutil.DefaultLogger )
Functions ¶
func ReflectConfig ¶
ReflectConfig set conf from confraw
func RegistFilterHandler ¶
func RegistFilterHandler(name string, handler FilterHandler)
RegistFilterHandler regist a filter handler
func RegistInputHandler ¶
func RegistInputHandler(name string, handler InputHandler)
RegistInputHandler regist a input handler
func RegistOutputHandler ¶
func RegistOutputHandler(name string, handler OutputHandler)
RegistOutputHandler regist a output handler
Types ¶
type CommonConfig ¶
type CommonConfig struct {
Type string `json:"type"`
}
CommonConfig is basic config struct
func (CommonConfig) GetType ¶
func (t CommonConfig) GetType() string
GetType return module type of config
type Config ¶
type Config struct { InputRaw []ConfigRaw `json:"input,omitempty" yaml:"input"` FilterRaw []ConfigRaw `json:"filter,omitempty" yaml:"filter"` OutputRaw []ConfigRaw `json:"output,omitempty" yaml:"output"` // channel size: chInFilter, chFilterOut, chOutDebug ChannelSize int `json:"chsize,omitempty" yaml:"chsize"` // enable debug channel, used for testing DebugChannel bool `json:"debugch,omitempty" yaml:"debugch"` // contains filtered or unexported fields }
Config contains all config
func LoadFromFile ¶
LoadFromFile load config from filepath
func LoadFromJSON ¶
LoadFromJSON load config from []byte in JSON format
func LoadFromYAML ¶
LoadFromYAML load config from []byte in YAML format
func (*Config) TestGetOutputEvent ¶
TestGetOutputEvent get an event from chOutDebug, used for testing
func (*Config) TestInputEvent ¶
TestInputEvent send an event to chInFilter, used for testing
type FilterConfig ¶
type FilterConfig struct {
CommonConfig
}
FilterConfig is basic filter config struct
type FilterHandler ¶
type FilterHandler func(ctx context.Context, raw *ConfigRaw) (TypeFilterConfig, error)
FilterHandler is a handler to regist filter module
type InputConfig ¶
type InputConfig struct {
CommonConfig
}
InputConfig is basic input config struct
type InputHandler ¶
type InputHandler func(ctx context.Context, raw *ConfigRaw) (TypeInputConfig, error)
InputHandler is a handler to regist input module
type OutputConfig ¶
type OutputConfig struct {
CommonConfig
}
OutputConfig is basic output config struct
type OutputHandler ¶
type OutputHandler func(ctx context.Context, raw *ConfigRaw) (TypeOutputConfig, error)
OutputHandler is a handler to regist output module
type TypeCommonConfig ¶
type TypeCommonConfig interface {
GetType() string
}
TypeCommonConfig is interface of basic config
type TypeFilterConfig ¶
type TypeFilterConfig interface { TypeCommonConfig Event(context.Context, logevent.LogEvent) logevent.LogEvent }
TypeFilterConfig is interface of filter module
type TypeInputConfig ¶
type TypeInputConfig interface { TypeCommonConfig Start(ctx context.Context, msgChan chan<- logevent.LogEvent) (err error) }
TypeInputConfig is interface of input module
type TypeOutputConfig ¶
type TypeOutputConfig interface { TypeCommonConfig Output(ctx context.Context, event logevent.LogEvent) (err error) }
TypeOutputConfig is interface of output module