Skip to content

Commit

Permalink
rebrand of Notify to Trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
symonk committed Jul 28, 2024
1 parent 4d257f4 commit 95414f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ security utility.

-----

## Actions & Modes
## Triggers

`log-analyse` allows applying both arbitrary `modes` and `actions` on a per
`glob` basis. These modes and actions are growing and right now but these
will be supported in the near future:
for now `log-analyse` allows the following (basic) triggers:

* `trigger:slack`: Dispatch a notification to slack.
* `trigger:teams`: Dispatch a notification to teams.
Expand Down Expand Up @@ -107,12 +105,11 @@ The config is composed of an array of objects, each of which currently supports

* `glob`: A glob pattern for file collection.
* `options`: An object of object for all files matching the glob.
* `active`: If the glob is enabled and should be monitored.
* `hits`: How many matches before alerting.
* `period`: Over what period should hits be considered before alerting.
* `patterns`: Per line regex patterns for lines of interest.
* `notify`: Which notification mechanism to fire for detections.
* `mode`: Which strategy/mode to apply when scanning the files.
* `on_match`: What to display based on matches.
* `trigger`: Which notification mechanism to fire for detections.


-----
Expand Down
1 change: 0 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ type Options struct {
Period string `yaml:"period" validate:"is-valid-time-duration"`
Patterns []string `yaml:"patterns" validate:"required"`
Trigger string `yaml:"trigger, omitempty"`
Notify string `yaml:"notify, omitempty"`
}
8 changes: 4 additions & 4 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ files:
active: false
hits: 5
period: 30s
notify: email
trigger: email
patterns:
- .*FATAL.*
- .*payment failed.*
Expand All @@ -25,7 +25,7 @@ files:
active: true
hits: 1
period: 1h10s
notify: slack
trigger: slack
patterns:
- .*critical error.*
`)
Expand Down Expand Up @@ -56,8 +56,8 @@ func TestCanBuildValidConfig(t *testing.T) {
assert.Equal(t, cfg.Files[1].Options.Period, "1h10s")
assert.Equal(t, cfg.Files[0].Options.Patterns, []string{".*FATAL.*", ".*payment failed.*"})
assert.Equal(t, cfg.Files[1].Options.Patterns, []string{".*critical error.*"})
assert.Equal(t, cfg.Files[0].Options.Notify, "email")
assert.Equal(t, cfg.Files[1].Options.Notify, "slack")
assert.Equal(t, cfg.Files[0].Options.Trigger, "email")
assert.Equal(t, cfg.Files[1].Options.Trigger, "slack")
}

func TestCanLoadSingleConfigBlock(t *testing.T) {
Expand Down

0 comments on commit 95414f4

Please sign in to comment.