Documentation ¶
Index ¶
- type Alert
- func (a *Alert) CanMerge(other *Alert) bool
- func (a *Alert) FullString() string
- func (a *Alert) Less(other *Alert) bool
- func (a *Alert) MergeEnabled() bool
- func (a *Alert) OutputDict() (map[string]any, error)
- func (a *Alert) RecordKey() map[string]any
- func (a *Alert) RemainingOutputs(requiredOutputs []string) []string
- func (a *Alert) String() string
- type AlertError
- type AlertOption
- func Attempts(attempts int) AlertOption
- func Cluster(cluster string) AlertOption
- func Created(created time.Time) AlertOption
- func Dispatched(dispatched time.Time) AlertOption
- func Formatters(formatters []string) AlertOption
- func LogSource(logSource string) AlertOption
- func LogType(logType string) AlertOption
- func MergeByKeys(mergeByKeys []string) AlertOption
- func MergeWindow(mergeWindow time.Duration) AlertOption
- func OutputsSent(outputsSent []string) AlertOption
- func RuleDescription(ruleDescription string) AlertOption
- func SourceEntity(sourceEntity string) AlertOption
- func SourceService(sourceService string) AlertOption
- func Staged(staged bool) AlertOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { AlertID string Attempts int Cluster string Created time.Time Dispatched time.Time LogSource string LogType string MergeByKeys []string MergeWindow time.Duration Dispatchers []string OutputsSent []string Formatters []string Record shared.Record RuleDescription string RuleName string RuleID string SourceEntity string SourceService string Staged bool }
Alert struct encapsulates a single alert and handles serialization
func NewAlert ¶
func NewAlert(ruleName string, record shared.Record, dispatchers []string, opts ...AlertOption) (*Alert, error)
NewAlert creates a new Alert
func (*Alert) FullString ¶
FullString returns a detailed representation of the alert
func (*Alert) MergeEnabled ¶
func (*Alert) OutputDict ¶
OutputDict converts the alert to a dictionary ready to send to an output
func (*Alert) RemainingOutputs ¶
type AlertError ¶
type AlertError struct {
Message string
}
AlertCreationError custom error for alert creation
func (*AlertError) Error ¶
func (e *AlertError) Error() string
type AlertOption ¶
type AlertOption func(*Alert)
AlertOption defines the functional option type
func Attempts ¶
func Attempts(attempts int) AlertOption
Attempts sets the number of attempts for the alert
func Created ¶
func Created(created time.Time) AlertOption
Created sets the creation time for the alert
func Dispatched ¶
func Dispatched(dispatched time.Time) AlertOption
Dispatched sets the dispatched time for the alert
func Formatters ¶
func Formatters(formatters []string) AlertOption
Formatters sets the formatters for the alert
func LogSource ¶
func LogSource(logSource string) AlertOption
LogSource sets the log source for the alert
func MergeByKeys ¶
func MergeByKeys(mergeByKeys []string) AlertOption
MergeByKeys sets the merge by keys for the alert
func MergeWindow ¶
func MergeWindow(mergeWindow time.Duration) AlertOption
MergeWindow sets the merge window for the alert
func OutputsSent ¶
func OutputsSent(outputsSent []string) AlertOption
OutputsSent sets the outputs sent for the alert
func RuleDescription ¶
func RuleDescription(ruleDescription string) AlertOption
RuleDescription sets the rule description for the alert
func SourceEntity ¶
func SourceEntity(sourceEntity string) AlertOption
SourceEntity sets the source entity for the alert
func SourceService ¶
func SourceService(sourceService string) AlertOption
SourceService sets the source service for the alert