Skip to content

Commit

Permalink
allow to set Slack channel
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Labarussias <[email protected]>
  • Loading branch information
Issif authored and poiana committed Sep 8, 2022
1 parent 747b68b commit 1f52a7d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ mutualtlsfilespath: "/etc/certs" # folder which will used to store client.crt, c
slack:
webhookurl: "" # Slack WebhookURL (ex: https://hooks.slack.com/services/XXXX/YYYY/ZZZZ), if not empty, Slack output is enabled
#channel: "" # Slack channel (optionnal)
#footer: "" # Slack footer
#icon: "" # Slack icon (avatar)
#username: "" # Slack username (default: Falcosidekick)
Expand Down Expand Up @@ -545,8 +546,7 @@ care of lower/uppercases**) : `yaml: a.b --> envvar: A_B` :
events, syntax is "key:value,key:value"
**MUTUALTLSFILESPATH**: path which will be used to stored certs and key for mutual tls authentication (default: "/etc/certs")
- **SLACK_WEBHOOKURL** : Slack Webhook URL (ex:
https://hooks.slack.com/services/XXXX/YYYY/ZZZZ), if not `empty`, Slack output
is _enabled_
- **SLACK_CHANNEL** : Slack Channel (optionnal)
- **SLACK_FOOTER** : Slack footer
- **SLACK_ICON** : Slack icon (avatar)
- **SLACK_USERNAME** : Slack username (default: `Falcosidekick`)
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func getConfig() *types.Configuration {
v.SetDefault("Slack.WebhookURL", "")
v.SetDefault("Slack.Footer", "https://github.com/falcosecurity/falcosidekick")
v.SetDefault("Slack.Username", "Falcosidekick")
v.SetDefault("Slack.Channel", "")
v.SetDefault("Slack.Icon", "https://raw.githubusercontent.com/falcosecurity/falcosidekick/master/imgs/falcosidekick_color.png")
v.SetDefault("Slack.OutputFormat", "all")
v.SetDefault("Slack.MessageFormat", "")
Expand Down
1 change: 1 addition & 0 deletions config_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mutualtlsfilespath: "/etc/certs" # folder which will used to store client.crt, c

slack:
webhookurl: "" # Slack WebhookURL (ex: https://hooks.slack.com/services/XXXX/YYYY/ZZZZ), if not empty, Slack output is enabled
#channel: "" # Slack channel (optionnal)
#footer: "" # Slack footer
#icon: "" # Slack icon (avatar)
#username: "" # Slack username (default: Falcosidekick)
Expand Down
5 changes: 5 additions & 0 deletions outputs/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type slackPayload struct {
Text string `json:"text,omitempty"`
Username string `json:"username,omitempty"`
IconURL string `json:"icon_url,omitempty"`
Channel string `json:"channel,omitempty"`
Attachments []slackAttachment `json:"attachments,omitempty"`
}

Expand Down Expand Up @@ -127,6 +128,10 @@ func newSlackPayload(falcopayload types.FalcoPayload, config *types.Configuratio
IconURL: config.Slack.Icon,
Attachments: attachments}

if config.Slack.Channel != "" {
s.Channel = config.Slack.Channel
}

return s
}

Expand Down
1 change: 1 addition & 0 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ type Configuration struct {
// SlackOutputConfig represents parameters for Slack
type SlackOutputConfig struct {
WebhookURL string
Channel string
Footer string
Icon string
Username string
Expand Down

0 comments on commit 1f52a7d

Please sign in to comment.