Skip to content

Commit

Permalink
chore(rule-engine): Dump events in rule matches
Browse files Browse the repository at this point in the history
When the rule is fired, besides including alert name and text, the list of all events that
triggered the alert are also included in the log message.
  • Loading branch information
rabbitstack committed Sep 7, 2024
1 parent f0b9a4f commit f410e6a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/filter/action/emit.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ import (
"github.com/rabbitstack/fibratus/pkg/config"
"github.com/rabbitstack/fibratus/pkg/util/markdown"
log "github.com/sirupsen/logrus"
"strings"
)

// Emit sends the rule alert via all configured alert senders.
func Emit(ctx *config.ActionContext, title string, text string, severity string, tags []string) error {
log.Infof("sending alert: [%s]. Text: %s", title, text)
var b strings.Builder
for _, evt := range ctx.Events {
b.WriteString(evt.String())
b.WriteByte('\n')
}
log.Infof("sending alert: [%s]. Text: %s Event(s): %s", title, text, b.String())

senders := alertsender.FindAll()
if len(senders) == 0 {
Expand Down

0 comments on commit f410e6a

Please sign in to comment.