Documentation ¶
Index ¶
- Variables
- func FilterMatchesEvent(event string, filter string, value interface{}) bool
- type ElasticsearchEventHandler
- func (handler *ElasticsearchEventHandler) Close() error
- func (handler *ElasticsearchEventHandler) Configure(config *viper.Viper) error
- func (handler *ElasticsearchEventHandler) ProcessEventStream(eventStream <-chan *nraySchema.Event)
- func (handler *ElasticsearchEventHandler) ProcessEvents(events []*nraySchema.Event)
- type EventHandler
- type JSONFileEventHandler
- type TerminalEventHandler
Constants ¶
This section is empty.
Variables ¶
var RegisteredHandlers = []string{"json-file", "terminal", "elasticsearch"}
RegisteredHandlers contains all handlers that may be configured by a user
Functions ¶
func FilterMatchesEvent ¶
FilterMatchesEvent returns true if the event has the filter string and its value matches the provided value
Types ¶
type ElasticsearchEventHandler ¶
type ElasticsearchEventHandler struct {
// contains filtered or unexported fields
}
ElasticsearchEventHandler implements the EventHandler interface and writes results to an elasticsearch instance
func (*ElasticsearchEventHandler) Close ¶
func (handler *ElasticsearchEventHandler) Close() error
Close waits until the events are written and closes the file descriptor
func (*ElasticsearchEventHandler) Configure ¶
func (handler *ElasticsearchEventHandler) Configure(config *viper.Viper) error
Configure takes a viper configuration to set up this event handler
func (*ElasticsearchEventHandler) ProcessEventStream ¶
func (handler *ElasticsearchEventHandler) ProcessEventStream(eventStream <-chan *nraySchema.Event)
ProcessEventStream takes a channel, reads the events and sends them to the internal processing where they are written. This function is useful for running in a dedicated goroutine
func (*ElasticsearchEventHandler) ProcessEvents ¶
func (handler *ElasticsearchEventHandler) ProcessEvents(events []*nraySchema.Event)
ProcessEvents takes a pointer to an array with events and passes them to the internal processing
type EventHandler ¶
type EventHandler interface { Configure(*viper.Viper) error ProcessEvents([]*nraySchema.Event) ProcessEventStream(<-chan *nraySchema.Event) Close() error }
EventHandler is the interface each type of handling events has to implement
func GetEventHandler ¶
func GetEventHandler(EventHandlerName string) EventHandler
GetEventHandler returns the correct event handler for a event handler name
type JSONFileEventHandler ¶
type JSONFileEventHandler struct {
// contains filtered or unexported fields
}
JSONFileEventHandler implements the EventHandler interface and writes events to a file
func (*JSONFileEventHandler) Close ¶
func (handler *JSONFileEventHandler) Close() error
Close waits until the events are written and closes the file descriptor
func (*JSONFileEventHandler) Configure ¶
func (handler *JSONFileEventHandler) Configure(config *viper.Viper) error
Configure takes a viper configuration for this event handler and reads the following values: filename: Where to store the file internal.channelsize: the size of the internally used buffering channel internal.synctimer: intervall to periodically flush events in seconds.
func (*JSONFileEventHandler) ProcessEventStream ¶
func (handler *JSONFileEventHandler) ProcessEventStream(eventStream <-chan *nraySchema.Event)
ProcessEventStream takes a channel, reads the events and sends them to the internal processing where they are written. This function is useful for running in a dedicated goroutine
func (*JSONFileEventHandler) ProcessEvents ¶
func (handler *JSONFileEventHandler) ProcessEvents(events []*nraySchema.Event)
ProcessEvents takes a pointer to an array with events and passes them to the internal processing
type TerminalEventHandler ¶
type TerminalEventHandler struct {
// contains filtered or unexported fields
}
TerminalEventHandler prints result to stdout
func (*TerminalEventHandler) Close ¶
func (t *TerminalEventHandler) Close() error
Close has to do nothing since no output channel has to be closed
func (*TerminalEventHandler) Configure ¶
func (t *TerminalEventHandler) Configure(config *viper.Viper) error
Configure does currently nothing as there is nothing to configure yet
func (*TerminalEventHandler) ProcessEventStream ¶
func (t *TerminalEventHandler) ProcessEventStream(eventStream <-chan *nraySchema.Event)
ProcessEventStream works like ProcessEvents but reads events from a stream
func (*TerminalEventHandler) ProcessEvents ¶
func (t *TerminalEventHandler) ProcessEvents(events []*nraySchema.Event)
ProcessEvents logs all events to stdout