Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new validation rule to avoid rename processor without checking event.original #583

Closed
mrodm opened this issue Sep 1, 2023 · 2 comments · Fixed by #690
Closed

Add new validation rule to avoid rename processor without checking event.original #583

mrodm opened this issue Sep 1, 2023 · 2 comments · Fixed by #690
Assignees

Comments

@mrodm
Copy link
Contributor

mrodm commented Sep 1, 2023

Originally posted in elastic/integrations#3451 (comment)

Add a new validation rule to ensure that if there is a rename processor whose target_field is event.original and field is message, it needs also to check that if key is defined checking about the presence of event.original in the document.

Moreover this new validation rule needs to check that a remove processor is defined to remove the message field, to avoid duplication.

As an example, if there is that rename processor in the ingest pipeline, a remove processor should exist and that rename processor should be like :

    - rename:
        field: message
        target_field: event.original
        # ignore_missing: true 
        if: 'ctx.event?.original == null'
    - remove:
        field: message
        ignore_missing: true
        if: 'ctx.event?.original != null'

Similar to what it was done in elastic/integrations#7026

@ishleenk17
Copy link

@mrodm : The remove processor validation should not be limited to just the message field.
So I am not sure if we should add this to the validation here.
There should be a generic validation that any field if renamed and not being used again should be removed.

@jillguyonnet
Copy link
Contributor

@ishleenk17 Apologies for not addressing your comment earlier. Renaming message to event.original is a common pattern (over 130 packages were affected in the test branch); it was straightforward enough to address through conditional schema, which also allowed stronger restrictions (such as the presence and value of the if property). Implementing a more general rule would probably open wider discussions and require a more involved approach. Please let us know if you have any concerns or feel free to open another issue to discuss this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants