Skip to content

Commit d2f056f

Browse files
authored
Fix rule for processors handing event.original so the check can be skipped (#1024)
In #1013 the spec for the processors required for event.original handling was modified to allow to remove the message field when included in an array. This modified the error message by adding the index in the array, what doesn't match anymore with the rule that allows to skip this test. Update the rules to match with this new pattern of error messages. Another rule is added to allow to skip this check in pipelines that only have a remove processor, that doesn't have if or ignore_missing properties.
1 parent bac680a commit d2f056f

File tree

3 files changed

+24
-1
lines changed
  • code/go/internal/validator
  • spec
  • test/packages/skip_pipeline_rename_validation/data_stream/invalid_message_rename/elasticsearch/ingest_pipeline

3 files changed

+24
-1
lines changed

code/go/internal/validator/spec.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,17 @@ func processErrors(errs specerrors.ValidationErrors) specerrors.ValidationErrors
127127
new: "%s: rename \"message\" to \"event.original\" processor requires remove \"message\" processor",
128128
},
129129
{
130-
matcher: regexp.MustCompile(`(processors.[0-9]+.remove.field): processors.[0-9]+.remove.field does not match: "message"`),
130+
matcher: regexp.MustCompile(`(processors.[0-9]+.remove.field(.[0-9]+)?): processors.[0-9]+.remove.field(.[0-9]+)? does not match: "message"`),
131131
new: "%s: rename \"message\" to \"event.original\" processor requires remove \"message\" processor",
132132
},
133133
{
134134
matcher: regexp.MustCompile(`(processors.[0-9]+.remove.if): processors.[0-9]+.remove.if does not match: "ctx\.event\?\.original != null"`),
135135
new: "%s: rename \"message\" to \"event.original\" processor requires remove \"message\" processor with if: 'ctx.event?.original != null'",
136136
},
137+
{
138+
matcher: regexp.MustCompile(`(field processors.[0-9]+.remove): (ignore_missing|if) is required`),
139+
new: "%s: rename \"message\" to \"event.original\" processor requires remove \"message\" processor with if: 'ctx.event?.original != null'",
140+
},
137141
}
138142

139143
// Filter out redundant errors

spec/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
- description: Require defining agent version constraints in input and integration packages.
1616
type: breaking-change
1717
link: https://github.com/elastic/package-spec/pull/999
18+
- version: 3.5.4
19+
changes:
20+
- description: Fix rule matching processor for event.original handling.
21+
type: bugfix
22+
link: https://github.com/elastic/package-spec/pull/1024/
1823
- version: 3.5.3
1924
changes:
2025
- description: Make support for alert rule templates more permissive.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
processors:
3+
- json:
4+
field: message
5+
target_field: json
6+
- rename:
7+
field: message
8+
target_field: event.original
9+
ignore_missing: true
10+
if: ctx.event?.original == null
11+
- remove:
12+
field:
13+
- message
14+
- json

0 commit comments

Comments
 (0)