Skip to content

Commit

Permalink
fixed SUMO-223934
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu219 committed May 3, 2024
1 parent 9bd3219 commit 126255c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lambda-extensions/sumoclient/sumoclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (s *sumoLogicClient) getLogStream() string {

func (s *sumoLogicClient) enhanceLogs(msg responseBody) {
s.logger.Debugln("Enhancing logs")
for _, item := range msg {
for idx, item := range msg {
// item["FunctionName"] = s.config.FunctionName
// item["FunctionVersion"] = s.config.FunctionVersion
// creating loggroup/logstream as they are not available in Env.
Expand All @@ -277,12 +277,18 @@ func (s *sumoLogicClient) enhanceLogs(msg responseBody) {
message = strings.TrimSpace(message)
json, err := utils.ParseJson(message)
if err != nil {
item["message"] = message
if s.config.EnhanceJsonLogs {
item["message"] = message
} else {
s.logger.Debug("EnhanceJsonLogs disabled sending only message.")
msg[idx] = map[string]interface{}{"message": message}
}
} else {
if s.config.EnhanceJsonLogs {
item["message"] = json
} else {
item = json
s.logger.Debug("EnhanceJsonLogs disabled sending only json log.")
msg[idx] = json
}
}
} else if ok && logType == "platform.report" {
Expand Down

0 comments on commit 126255c

Please sign in to comment.