From 420505e93da4689a60f0dc5bc0979aad517b424b Mon Sep 17 00:00:00 2001 From: Philip Germanov Date: Tue, 29 Jul 2025 15:22:35 +0300 Subject: [PATCH] feat(log): improve error message formatting by combining message and error details --- pkg/splunk/splunk.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/splunk/splunk.go b/pkg/splunk/splunk.go index 6feded684..64e90b774 100644 --- a/pkg/splunk/splunk.go +++ b/pkg/splunk/splunk.go @@ -117,8 +117,18 @@ func (s *Splunk) prepareTelemetry(telemetryData telemetry.Data) MonitoringData { if fatalErrorDetail := log.GetFatalErrorDetail(); fatalErrorDetail != nil { var errorDetail map[string]any if err := json.Unmarshal(fatalErrorDetail, &errorDetail); err == nil { + var parts []string + + if messageVal, exists := errorDetail["message"]; exists && messageVal != nil { + parts = append(parts, fmt.Sprintf("%v", messageVal)) + } + if errorVal, exists := errorDetail["error"]; exists && errorVal != nil { - errorMessage = fmt.Sprintf("%v", errorVal) + parts = append(parts, fmt.Sprintf("%v", errorVal)) + } + + if len(parts) > 0 { + errorMessage = strings.Join(parts, " ") } } }