diff --git a/internal/k8s/app_protect_resources.go b/internal/k8s/app_protect_resources.go index 685f54421f..b3f942de53 100644 --- a/internal/k8s/app_protect_resources.go +++ b/internal/k8s/app_protect_resources.go @@ -55,14 +55,22 @@ func ValidateAppProtectLogConf(logConf *unstructured.Unstructured) error { return nil } -var logDstEx = regexp.MustCompile(`syslog:server=((?:\d{1,3}\.){3}\d{1,3}|localhost):\d{1,5}`) +var logDstEx = regexp.MustCompile(`(?:syslog:server=((?:\d{1,3}\.){3}\d{1,3}|localhost):\d{1,5})|stderr|(?:\/[\S]+)+`) +var logDstFileEx = regexp.MustCompile(`(?:\/[\S]+)+`) // ValidateAppProtectLogDestinationAnnotation validates annotation for log destination configuration func ValidateAppProtectLogDestinationAnnotation(dstAntn string) error { - errormsg := "Error parsing App Protect Log config: Destination Annotation must follow format: syslog:server=:" + errormsg := "Error parsing App Protect Log config: Destination Annotation must follow format: syslog:server=: or stderr or absolute path to file" if !logDstEx.MatchString(dstAntn) { return fmt.Errorf("%s Log Destination did not follow format", errormsg) } + if dstAntn == "stderr" { + return nil + } + + if logDstFileEx.MatchString(dstAntn) { + return nil + } dstchunks := strings.Split(dstAntn, ":")