Documentation ¶
Overview ¶
Package event defines an API to implement a simple security event notification system.
This package is a work in progress and makes no API stability promises.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrCanceledRequest = errors.New("event: canceled request") ErrBadRequest = errors.New("event: bad request") ErrNotSupported = errors.New("event: not supported") ErrInternal = errors.New("event: internal error") )
Some standard errors returned by interfaces.
Functions ¶
func SetDefaultInstance ¶
func SetDefaultInstance(label string)
SetDefaultInstance changes default instance name.
Types ¶
type Event ¶
type Event struct { // info completed on construction Code Code `json:"code"` Level Level `json:"level"` Created time.Time `json:"created"` Source Source `json:"source"` Duplicates int `json:"duplicates"` Data map[string]interface{} `json:"data,omitempty" bson:",omitempty"` // info completed by Notifier ID string `json:"id" bson:"_id"` Type Type `json:"type"` Received time.Time `json:"received"` Codename string `json:"codename"` Description string `json:"description"` Processors []ProcessInfo `json:"processors,omitempty" bson:",omitempty"` Tags []string `json:"tags,omitempty" bson:",omitempty"` }
Event stores event info.
type Level ¶
type Level int8
Level defines the level of event.
func ToEventLevel ¶
ToEventLevel returns event level from string, raise if ok and error if bad value.
func (Level) MarshalJSON ¶
MarshalJSON implements interface for struct marshalling.
func (*Level) UnmarshalJSON ¶
UnmarshalJSON implements interface for struct unmarshalling.
type NotifyBuffer ¶
NotifyBuffer is the interface for event buffer implementations.
type ProcessInfo ¶
type ProcessInfo struct { Received time.Time `json:"received"` Processor Source `json:"processor"` }
ProcessInfo stores event processing info.
type Source ¶
type Source struct { Hostname string `json:"hostname"` Program string `json:"program"` Instance string `json:"instance"` PID int `json:"pid"` }
Source stores event source information.
func GetDefaultSource ¶
func GetDefaultSource() Source
GetDefaultSource returns default notify events source.
type Threshold ¶
type Threshold struct {
// contains filtered or unexported fields
}
Threshold is used for define threshold.
type Type ¶
type Type int8
Type defines the type of event.
func (Type) MarshalJSON ¶
MarshalJSON implements interface for struct marshalling.
func (*Type) UnmarshalJSON ¶
UnmarshalJSON implements interface for struct unmarshalling.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
grpc
|
|
archive
Package archive implements a event.Archive client and a ready to use service component.
|
Package archive implements a event.Archive client and a ready to use service component. |
forward
Package forward implements a event.Forwarder client and a ready to use service component.
|
Package forward implements a event.Forwarder client and a ready to use service component. |
notify
Package notify implements a event.Notifier client and a ready to use service component.
|
Package notify implements a event.Notifier client and a ready to use service component. |
Package notifybuffer provides a simple event.NotifyBuffer implementation.
|
Package notifybuffer provides a simple event.NotifyBuffer implementation. |