diff --git a/docs/api.md b/docs/api.md index aee8bb91b..a2253e606 100644 --- a/docs/api.md +++ b/docs/api.md @@ -161,7 +161,7 @@ Following is the supported API format for filter transformations: remove_entry_if_equal: removes the entry if the field value equals specified value remove_entry_if_not_equal: removes the entry if the field value does not equal specified value remove_entry_all_satisfied: removes the entry if all of the defined rules are satisfied - keep_entry: keeps the entry if the set of rules are all satisfied + keep_entry_all_satisfied: keeps the entry if the set of rules are all satisfied add_field: adds (input) field to the entry; overrides previous value if present (key=input, value=value) add_field_if_doesnt_exist: adds a field to the entry if the field does not exist add_field_if: add output field set to assignee if input field satisfies criteria from parameters field diff --git a/pkg/api/transform_filter.go b/pkg/api/transform_filter.go index 7e48382ff..2514ac131 100644 --- a/pkg/api/transform_filter.go +++ b/pkg/api/transform_filter.go @@ -46,7 +46,7 @@ const ( RemoveEntryIfEqual TransformFilterEnum = "remove_entry_if_equal" // removes the entry if the field value equals specified value RemoveEntryIfNotEqual TransformFilterEnum = "remove_entry_if_not_equal" // removes the entry if the field value does not equal specified value RemoveEntryAllSatisfied TransformFilterEnum = "remove_entry_all_satisfied" // removes the entry if all of the defined rules are satisfied - KeepEntry TransformFilterEnum = "keep_entry" // keeps the entry if the set of rules are all satisfied + KeepEntryAllSatisfied TransformFilterEnum = "keep_entry_all_satisfied" // keeps the entry if the set of rules are all satisfied AddField TransformFilterEnum = "add_field" // adds (input) field to the entry; overrides previous value if present (key=input, value=value) AddFieldIfDoesntExist TransformFilterEnum = "add_field_if_doesnt_exist" // adds a field to the entry if the field does not exist AddFieldIf TransformFilterEnum = "add_field_if" // add output field set to assignee if input field satisfies criteria from parameters field diff --git a/pkg/pipeline/transform/transform_filter.go b/pkg/pipeline/transform/transform_filter.go index 71c00032e..517259432 100644 --- a/pkg/pipeline/transform/transform_filter.go +++ b/pkg/pipeline/transform/transform_filter.go @@ -157,7 +157,7 @@ func applyRule(entry config.GenericMap, labels map[string]string, rule *api.Tran return !isRemoveEntrySatisfied(entry, rule.RemoveEntryAllSatisfied) case api.ConditionalSampling: return sample(entry, rule.ConditionalSampling) - case api.KeepEntry: + case api.KeepEntryAllSatisfied: return rollSampling(rule.KeepEntrySampling) && isKeepEntrySatisfied(entry, rule.KeepEntryAllSatisfied) default: tlog.Panicf("unknown type %s for transform.Filter rule: %v", rule.Type, rule) @@ -250,7 +250,7 @@ func NewTransformFilter(params config.StageParam) (Transformer, error) { return nil, err } for i := range params.Transform.Filter.Rules { - if params.Transform.Filter.Rules[i].Type == api.KeepEntry { + if params.Transform.Filter.Rules[i].Type == api.KeepEntryAllSatisfied { keepRules = append(keepRules, params.Transform.Filter.Rules[i]) } else { rules = append(rules, params.Transform.Filter.Rules[i]) diff --git a/pkg/pipeline/transform/transform_filter_test.go b/pkg/pipeline/transform/transform_filter_test.go index 72c288081..be214ab36 100644 --- a/pkg/pipeline/transform/transform_filter_test.go +++ b/pkg/pipeline/transform/transform_filter_test.go @@ -676,7 +676,7 @@ func Test_Transform_KeepEntry(t *testing.T) { newFilter := api.TransformFilter{ Rules: []api.TransformFilterRule{ { - Type: api.KeepEntry, + Type: api.KeepEntryAllSatisfied, KeepEntryAllSatisfied: []*api.KeepEntryRule{ { Type: api.KeepEntryIfEqual, @@ -694,7 +694,7 @@ func Test_Transform_KeepEntry(t *testing.T) { }, }, { - Type: api.KeepEntry, + Type: api.KeepEntryAllSatisfied, KeepEntryAllSatisfied: []*api.KeepEntryRule{ { Type: api.KeepEntryIfRegexMatch, @@ -742,7 +742,7 @@ func Test_Transform_KeepEntrySampling(t *testing.T) { newFilter := api.TransformFilter{ Rules: []api.TransformFilterRule{ { - Type: api.KeepEntry, + Type: api.KeepEntryAllSatisfied, KeepEntryAllSatisfied: []*api.KeepEntryRule{ { Type: api.KeepEntryIfEqual, @@ -755,7 +755,7 @@ func Test_Transform_KeepEntrySampling(t *testing.T) { KeepEntrySampling: 10, }, { - Type: api.KeepEntry, + Type: api.KeepEntryAllSatisfied, KeepEntryAllSatisfied: []*api.KeepEntryRule{ { Type: api.KeepEntryIfEqual,