diff --git a/internal/support/search/search.go b/internal/support/search/search.go
index 40962be1..1901494e 100644
--- a/internal/support/search/search.go
+++ b/internal/support/search/search.go
@@ -1,6 +1,7 @@
package search
import (
+ "fmt"
"regexp"
"strings"
@@ -61,14 +62,8 @@ func searchMapAny(re *regexp.Regexp, orderedMap *orderedmap.OrderedMap[string, a
}
case []any:
- for i, v := range value {
- switch v := v.(type) {
- case string:
- if re.MatchString(v) {
- found = true
- value[i] = re.ReplaceAllString(v, "$0")
- }
- }
+ if searchArray(re, value) {
+ found = true
}
case *orderedmap.OrderedMap[string, any]:
@@ -86,6 +81,13 @@ func searchMapAny(re *regexp.Regexp, orderedMap *orderedmap.OrderedMap[string, a
found = true
}
+ case int, float64, bool:
+ formatted := fmt.Sprintf("%v", value)
+ if re.MatchString(formatted) {
+ orderedMap.Set(pair.Key, re.ReplaceAllString(formatted, "$0"))
+ found = true
+ }
+
default:
log.Debug().Type("type", value).Msg("unknown logEvent type inside searchMapAny")
}
@@ -105,14 +107,8 @@ func searchMap(re *regexp.Regexp, data map[string]interface{}) bool {
}
case []any:
- for i, v := range value {
- switch v := v.(type) {
- case string:
- if re.MatchString(v) {
- found = true
- value[i] = re.ReplaceAllString(v, "$0")
- }
- }
+ if searchArray(re, value) {
+ found = true
}
case map[string]interface{}:
@@ -120,6 +116,12 @@ func searchMap(re *regexp.Regexp, data map[string]interface{}) bool {
found = true
}
+ case int, float64, bool:
+ formatted := fmt.Sprintf("%v", value)
+ if re.MatchString(formatted) {
+ data[key] = re.ReplaceAllString(formatted, "$0")
+ found = true
+ }
default:
log.Debug().Type("type", value).Msg("unknown logEvent type inside searchMap")
}
@@ -138,3 +140,32 @@ func searchMapString(re *regexp.Regexp, orderedMap *orderedmap.OrderedMap[string
}
return found
}
+
+func searchArray(re *regexp.Regexp, data []any) bool {
+ found := false
+ for i, value := range data {
+ switch value := value.(type) {
+ case string:
+ if re.MatchString(value) {
+ data[i] = re.ReplaceAllString(value, "$0")
+ found = true
+ }
+ case int, float64, bool:
+ formatted := fmt.Sprintf("%v", value)
+ if re.MatchString(formatted) {
+ data[i] = re.ReplaceAllString(formatted, "$0")
+ found = true
+ }
+ case []any:
+ if searchArray(re, value) {
+ found = true
+ }
+ case map[string]interface{}:
+ if searchMap(re, value) {
+ found = true
+ }
+ }
+ }
+
+ return found
+}