Filter out log lines not matching list

Signed-off-by: Michel Hollands <michel.hollands@gmail.com>
This commit is contained in:
Michel Hollands
2024-03-26 17:18:00 +00:00
parent a89ba944a3
commit 19763f7310
3 changed files with 24 additions and 6 deletions

View File

@@ -45,10 +45,18 @@ data:
forward_to = [ {{ include "agent.loki_process_targets" . }} ]
}
{{- if not (empty .Values.logs.piiRegexes) }}
loki.process "PII" {
{{- if or (not (empty .Values.logs.retain)) (not (empty .Values.logs.piiRegexes)) }}
loki.process "filter" {
forward_to = [ {{ include "agent.loki_write_targets" . }} ]
{{- if not (empty .Values.logs.retain) }}
stage.match {
selector = "{cluster=\"{{- .Values.clusterName -}}\"} !~ \"{{ join "|" .Values.logs.retain }}\""
action = "drop"
}
{{- end }}
{{- if not (empty .Values.logs.piiRegexes) }}
{{- range .Values.logs.piiRegexes }}
stage.replace {
expression = "{{ .expression }}"
@@ -56,6 +64,7 @@ data:
replace = "{{ .replace }}"
}
{{- end }}
{{- end }}
}
{{- end }}
{{- end }}