Skip to content
Snippets Groups Projects
Commit fe5de2e1 authored by Francé Wilke's avatar Francé Wilke
Browse files

Improve SQS logging

parent 70341dde
No related branches found
No related tags found
No related merge requests found
......@@ -266,9 +266,26 @@ func LogApiAudit(fields log.Fields) {
}
func LogSQSEvent(event events.SQSEvent) {
sqsReducedEvents := []map[string]string{}
for _, record := range event.Records {
reducedEvent := map[string]string{
"message_id": record.MessageId,
"body": record.Body,
"sender": record.Attributes["SenderId"],
}
for key, attribute := range record.MessageAttributes {
if key != "Name" {
reducedEvent[key] = *attribute.StringValue
}
}
sqsReducedEvents = append(sqsReducedEvents, reducedEvent)
}
InfoWithFields(map[string]interface{}{
"records": event.Records,
}, "SQS event start")
"records": sqsReducedEvents,
}, "")
}
func SetOutputToFile(file *os.File) {
......
......@@ -135,7 +135,6 @@ func SendSQSMessage(msgr Messenger, objectToSend interface{}, currentRequestID *
message := string(jsonBytes)
headers := map[string]string{
"Name": "dummy",
SQSMessageOnS3Key: "false",
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment