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

[cloudflare_logpush] Fix logic on http_request rename processors #8629

Merged

Conversation

taylor-swanson
Copy link
Contributor

@taylor-swanson taylor-swanson commented Dec 1, 2023

Proposed commit message

  • Fixed incorrect if statements on rename processors for fields that were renamed by Cloudflare.
  • If both fields were present, then the second rename processor would try to run when it should've been skipped. Rename processors cannot rename a field to one that already exists.
  • Fixed mismatch of field names for firewall.matches between the pipeline and the field definitions
  • Updated pipeline tests to cover these cases

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Related issues

- Fixed incorrect if statements on rename processors for fields that
were renamed by Cloudflare.
- If both fields were present, then the second rename processor would
try to run when it should've been skipped. Rename processors cannot
rename a field to one that already exists.
@taylor-swanson taylor-swanson added bug Something isn't working, use only for issues Team:Security-External Integrations Integration:cloudflare_logpush Cloudflare Logpush labels Dec 1, 2023
@taylor-swanson taylor-swanson self-assigned this Dec 1, 2023
@elasticmachine
Copy link

elasticmachine commented Dec 1, 2023

🚀 Benchmarks report

Package cloudflare_logpush 👍(9) 💚(8) 💔(1)

Expand to view
Data stream Previous EPS New EPS Diff (%) Result
nel_report 25641.03 16666.67 -8974.36 (-35%) 💔

To see the full report comment with /test benchmark fullreport

@elasticmachine
Copy link

elasticmachine commented Dec 1, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Duration: 29 min 1 sec

Test stats 🧪

Test Results
Failed 0
Passed 115
Skipped 0
Total 115

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Dec 1, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (18/18) 💚
Files 100.0% (18/18) 💚
Classes 100.0% (18/18) 💚
Methods 100.0% (215/215) 💚 75.0
Lines 91.723% (4898/5340) 👎 -8.277
Conditionals 100.0% (0/0) 💚

@taylor-swanson taylor-swanson marked this pull request as ready for review December 1, 2023 17:12
@taylor-swanson taylor-swanson requested a review from a team as a code owner December 1, 2023 17:12
@elasticmachine
Copy link

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs a test case to demonstrate the issue.

@taylor-swanson
Copy link
Contributor Author

taylor-swanson commented Dec 4, 2023

@efd6, I was thinking about that. We don't have a test case that tests any of these fields right now. I could make one up, but I'd rather it come from a real log. I had manually tested with log created by the user who filed the related issue, but I'm not sure how much of that log was real and what was added artificially to trigger the issue.

@jamiehynds, do you know if we have more sample data for this integration (Cloudflare Logpush)?

In the event that we don't, I may just copy one of our existing logs and add the fields that way.

Edit: Never mind, I must've been looking at the wrong file by mistake, we do test these fields. I had originally renamed the old fields to the new. I'll re-add the old fields alongside the new, which will test this case.

@@ -510,31 +510,31 @@ processors:
value: '{{{_ingest.on_failure_message}}}'
- rename:
field: json.SecurityActions
target_field: cloudflare_logpush.http_request.firewall.match.action
target_field: cloudflare_logpush.http_request.firewall.matches.action
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why the names are being changed as well. This is not explained in the commit messages or issue AFAICS. Can this detail be added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add this to the commit message. This was a bug with the original implementation. The field definitions did not match those in the pipeline. This was never caught before because we didn't have those fields in the test data (which I've added now).

@taylor-swanson taylor-swanson merged commit 65f0e61 into elastic:main Dec 12, 2023
4 checks passed
@taylor-swanson taylor-swanson deleted the bug/cloudflare_logpush-if-logic branch December 12, 2023 13:46
@elasticmachine
Copy link

Package cloudflare_logpush - 1.17.3 containing this change is available at https://epr.elastic.co/search?package=cloudflare_logpush

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working, use only for issues Integration:cloudflare_logpush Cloudflare Logpush
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cloudflare Logpush] Pipeline bug with http_request security fields
3 participants