Skip to content

Commit bca5499

Browse files
committed
feat(kyverno): add support for message exclusions in error pattern filtering
1 parent 0619434 commit bca5499

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [Unreleased]
1010

11+
## [0.13.1] - 2026-02-05
12+
13+
[Compare with previous version](https://github.com/sparkfabrik/terraform-google-services-monitoring/compare/0.13.0...0.13.1)
14+
15+
### Changed
16+
17+
- Extend `error_patterns_exclude` behavior: excluded patterns now also generate `NOT jsonPayload.message=~"pattern"` conditions, allowing exclusion of logs where the pattern appears in the message field (not just the error field).
18+
1119
## [0.13.0] - 2026-02-04
1220

1321
[Compare with previous version](https://github.com/sparkfabrik/terraform-google-services-monitoring/compare/0.12.0...0.13.0)

kyverno.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ locals {
5656
"jsonPayload.error=~\"(?i)${pattern}\""
5757
]) : ""
5858

59+
# Build NOT conditions for excluded patterns on jsonPayload.message
60+
kyverno_message_exclusions = length(var.kyverno.error_patterns_exclude) > 0 ? join("\n ", [
61+
for pattern in var.kyverno.error_patterns_exclude :
62+
"AND NOT jsonPayload.message=~\"(?i)${pattern}\""
63+
]) : ""
64+
5965
kyverno_log_filter = local.kyverno_cluster_name != "" && length(local.kyverno_active_error_patterns) > 0 ? (<<-EOT
6066
resource.type="k8s_container"
6167
AND resource.labels.project_id="${local.kyverno_project_id}"
@@ -68,6 +74,7 @@ locals {
6874
AND (
6975
${local.kyverno_error_patterns_filter}
7076
)
77+
${local.kyverno_message_exclusions}
7178
EOT
7279
) : ""
7380
}

0 commit comments

Comments
 (0)