filter out random request ID value

This commit is contained in:
Daniel Hougaard
2025-06-01 21:31:26 +04:00
parent b4f26aac25
commit 22f32e060b
2 changed files with 7 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import (
"log"
"os"
"os/exec"
"regexp"
"strings"
)
@@ -71,7 +72,11 @@ func SetupCli() {
}
func FilterRequestID(input string) string {
// Find the JSON part of the error message
requestIDPattern := regexp.MustCompile(`\[request-id=[^\]]+\]`)
reqIDPattern := regexp.MustCompile(`\[reqId=[^\]]+\]`)
input = requestIDPattern.ReplaceAllString(input, "[request-id=<unknown-value>]")
input = reqIDPattern.ReplaceAllString(input, "[reqId=<unknown-value>]")
start := strings.Index(input, "{")
end := strings.LastIndex(input, "}") + 1