Skip to content

Commit

Permalink
remove brackets in labels + add Number as DataType
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 Mar 20, 2023
1 parent 537a915 commit 3524e70
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions outputs/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,17 @@ func (c *Client) PublishTopic(falcopayload types.FalcoPayload) {
}
}
for i, j := range falcopayload.OutputFields {
switch v := j.(type) {
m := strings.ReplaceAll(strings.ReplaceAll(i, "]", ""), "[", ".")
switch j.(type) {
case string:
msg.MessageAttributes[i] = &sns.MessageAttributeValue{
msg.MessageAttributes[m] = &sns.MessageAttributeValue{
DataType: aws.String("String"),
StringValue: aws.String(strings.ReplaceAll(strings.ReplaceAll(v, "]", ""), "[", ".")),
StringValue: aws.String(fmt.Sprintf("%v", j)),
}
case json.Number:
msg.MessageAttributes[m] = &sns.MessageAttributeValue{
DataType: aws.String("Number"),
StringValue: aws.String(fmt.Sprintf("%v", j)),
}
default:
continue
Expand Down

0 comments on commit 3524e70

Please sign in to comment.