Skip to content

Commit

Permalink
fix typo in priority in all switch/case
Browse files Browse the repository at this point in the history
  • Loading branch information
Issif committed Oct 18, 2019
1 parent 91fb9c5 commit c18be78
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 30 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.9.3 - 2019-10-18
#### Fix
- Fix typo in priority check ([PR#42](https://github.com/falcosecurity/falcosidekick/pull/42) thanks to [@palmerabollo](https://github.com/palmerabollo))

## 2.9.2 - 2019-10-11
#### Enhancement
- Add formatted Text in Slack message ([PR#40](https://github.com/falcosecurity/falcosidekick/pull/40) thanks to [@actgardner](https://github.com/actgardner))
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func getConfig() *types.Configuration {
if c.ListenPort == 0 || c.ListenPort > 65536 {
log.Fatalf("[ERROR] : Bad port number\n")
}
if match, _ := regexp.MatchString("(?i)(emergency|alert|critical|error|warning|notice|informationnal|debug)", c.Slack.MinimumPriority); !match {
if match, _ := regexp.MatchString("(?i)(emergency|alert|critical|error|warning|notice|informational|debug)", c.Slack.MinimumPriority); !match {
c.Slack.MinimumPriority = ""
c.Teams.MinimumPriority = ""
}
Expand Down
24 changes: 12 additions & 12 deletions config_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,55 @@ slack:
#footer: "" # Slack footer
#icon: "" # Slack icon (avatar)
outputformat: "text" # all (default), text, fields
minimumpriority: "debug" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
minimumpriority: "debug" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)
messageformat: "Alert : rule *{{ .Rule }}* triggered by user *{{ index .OutputFields \"user.name\" }}*" # a Go template to format Slack Text above Attachment, displayed in addition to the output from `SLACK_OUTPUTFORMAT`, see [Slack Message Formatting](#slack-message-formatting) in the README for details. If empty, no Text is displayed before Attachment.

teams:
webhookurl: "" # Teams WebhookURL (ex: https://hooks.slack.com/services/XXXX/YYYY/ZZZZ), if not empty, Teams output is enabled
#activityimage: "" # Image for message section
outputformat: "text" # all (default), text, facts
minimumpriority: "debug" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
minimumpriority: "debug" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

datadog:
#apikey: "" # Datadog API Key, if not empty, Datadog output is enabled
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

alertmanager:
# hostport: "" # http://{domain or ip}:{port}, if not empty, Alertmanager output is enabled
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

elasticsearch:
# hostport: "" # http://{domain or ip}:{port}, if not empty, Elasticsearch output is enabled
# index: "falco" # index (default: falco)
# type: "event"
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)
# suffix: "daily" # date suffix for index rotation : daily (default), monthly, annually, none

influxdb:
# hostport: "" # http://{domain or ip}:{port}, if not empty, Influxdb output is enabled
# database: "falco" # Influxdb database (default: falco)
# user: "" # user to use if auth is enabled in Influxdb
# password: "" # pasword to use if auth is enabled in Influxdb
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

loki:
# hostport: "" # http://{domain or ip}:{port}, if not empty, Loki output is enabled
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

nats:
# hostport: "" # nats://{domain or ip}:{port}, if not empty, NATS output is enabled
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

aws:
# accesskeyid: "" # aws access key (optionnal if you use EC2 Instance Profile)
# secretaccesskey: "" # aws secret access key (optionnal if you use EC2 Instance Profile)
# region : "" # aws region (optionnal if you use EC2 Instance Profile)
lambda:
# functionname : "" # Lambda function name, if not empty, AWS Lambda output is enabled
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)
sqs:
# url : "" # SQS Queue URL, if not empty, AWS SQS output is enabled
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

smtp:
# hostport: "" # host:port address of SMTP server, if not empty, SMTP output is enabled
Expand All @@ -67,9 +67,9 @@ smtp:
# from: "" # Sender address (mandatory if SMTP output is enabled)
# to: "" # comma-separated list of Recipident addresses, can't be empty (mandatory if SMTP output is enabled)
# outputformat: "" # html (default), text
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

opsgenie:
# apikey: "" # Opsgenie API Key, if not empty, Opsgenie output is enabled
# region: "eu" # (us|eu) region of your domain
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informationnal|debug or "" (default)
# minimumpriority: "" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)
4 changes: 2 additions & 2 deletions deploy/helm/falcosidekick/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: v1
appVersion: "2.9.2"
appVersion: "2.9.3"
description: A simple daemon to help you with falco's outputs
icon: https://raw.githubusercontent.com/falcosecurity/falcosidekick/master/imgs/falcosidekick.png
name: falcosidekick
version: 0.1.7
version: 0.1.8
maintainers:
- name: SweetOps
- name: Issif
2 changes: 1 addition & 1 deletion deploy/helm/falcosidekick/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicaCount: 1

image:
repository: falcosecurity/falcosidekick
tag: 2.9.2
tag: 2.9.3
pullPolicy: IfNotPresent

nameOverride: ""
Expand Down
20 changes: 10 additions & 10 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import (

func getPriorityMap() map[string]int {
return map[string]int{
"emergency": 8,
"alert": 7,
"critical": 6,
"error": 5,
"warning": 4,
"notice": 3,
"informationnal": 2,
"debug": 1,
"": 0,
"emergency": 8,
"alert": 7,
"critical": 6,
"error": 5,
"warning": 4,
"notice": 3,
"informational": 2,
"debug": 1,
"": 0,
}
}

Expand Down Expand Up @@ -58,7 +58,7 @@ func mainHandler(w http.ResponseWriter, r *http.Request) {

stats.Requests.Add("accepted", 1)
switch strings.ToLower(falcopayload.Priority) {
case "emergency", "alert", "critical", "error", "warning", "notice", "informationnal", "debug":
case "emergency", "alert", "critical", "error", "warning", "notice", "informational", "debug":
stats.Falco.Add(strings.ToLower(falcopayload.Priority), 1)
}

Expand Down
2 changes: 1 addition & 1 deletion outputs/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func newSlackPayload(falcopayload types.FalcoPayload, config *types.Configuratio
color = "#ffff00"
case "notice":
color = "#5bffb5"
case "informationnal":
case "informational":
color = "#68c2ff"
case "debug":
color = "#ccfff2"
Expand Down
2 changes: 1 addition & 1 deletion outputs/smtp_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var htmlTmpl = `
{{ if or (eq .Priority "Error") (eq .Priority "error") }}{{ $color = "#ffc700" }}{{ end }}
{{ if or (eq .Priority "Warning") (eq .Priority "warning") }}{{ $color = "#ffff00" }}{{ end }}
{{ if or (eq .Priority "Notice") (eq .Priority "notice") }}{{ $color = "#5bffb5" }}{{ end }}
{{ if or (eq .Priority "Informationnal") (eq .Priority "informationnal") }}{{ $color = "#68c2ff" }}{{ end }}
{{ if or (eq .Priority "Informational") (eq .Priority "informational") }}{{ $color = "#68c2ff" }}{{ end }}
{{ if or (eq .Priority "Debug") (eq .Priority "debug") }}{{ $color = "#ccfff2" }}{{ end }}
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
Expand Down
2 changes: 1 addition & 1 deletion outputs/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func newTeamsPayload(falcopayload types.FalcoPayload, config *types.Configuratio
color = "ffff00"
case "notice":
color = "5bffb5"
case "informationnal":
case "informational":
color = "68c2ff"
case "debug":
color = "ccfff2"
Expand Down
2 changes: 1 addition & 1 deletion stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func getInitStats() *types.Statistics {
stats.Falco.Add("error", 0)
stats.Falco.Add("warning", 0)
stats.Falco.Add("notice", 0)
stats.Falco.Add("informationnal", 0)
stats.Falco.Add("informational", 0)
stats.Falco.Add("debug", 0)
stats.Slack.Add("total", 0)
stats.Slack.Add("error", 0)
Expand Down

0 comments on commit c18be78

Please sign in to comment.