Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to set Slack channel #366

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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