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

[Trendmicro Vision One] - Fixed cursor & pagination logic for "detections" data stream #12916

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ShourieG
Copy link
Contributor

@ShourieG ShourieG commented Feb 27, 2025

Type of change

  • Bug

Proposed commit message

Fixed cursor & pagination logic for "detections" data stream to mirror a similar logic in implemented for a google_workspace fix.

Please refer to this issue to see the details.

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.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

@ShourieG ShourieG self-assigned this Feb 27, 2025
@ShourieG ShourieG added Integration:trend_micro_vision_one Trend Micro Vision One Team:Security-Service Integrations Security Service Integrations Team [elastic/security-service-integrations] bugfix Pull request that fixes a bug issue labels Feb 27, 2025
@ShourieG ShourieG requested a review from efd6 February 27, 2025 08:52
@ShourieG
Copy link
Contributor Author

ShourieG commented Feb 27, 2025

TODO - test this with a live account

@ShourieG ShourieG removed the request for review from efd6 February 27, 2025 08:55
@elastic-vault-github-plugin-prod
Copy link

elastic-vault-github-plugin-prod bot commented Feb 27, 2025

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@ShourieG ShourieG marked this pull request as ready for review February 27, 2025 11:39
@ShourieG ShourieG requested a review from a team as a code owner February 27, 2025 11:39
@elasticmachine
Copy link

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@ShourieG ShourieG requested a review from efd6 February 27, 2025 11:40
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.

This seems reasonable, but needs some commentary clean ups.

# If last pagination cycle was finished successfully
# we move the startDate pointer forward
# else we reprocess the last interval from the beginning.
# If none of the values are in the cursor it means is a fresh start
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# If none of the values are in the cursor it means is a fresh start
# If none of the values are in the cursor it means it is a fresh start

@@ -27,29 +27,49 @@ request.transforms:
value: '{{page_size}}'
- set:
target: url.params.startDateTime
value: '[[formatDate ((parseDate .cursor.last_update_at).Add (parseDuration "-{{additional_look_back}}"))]]'
# If last pagination cycle was finished successfully
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# If last pagination cycle was finished successfully
# If the last pagination cycle was completed successfully

value: '[[formatDate ((parseDate .cursor.last_update_at).Add (parseDuration "-{{additional_look_back}}"))]]'
# If last pagination cycle was finished successfully
# we move the startDate pointer forward
# else we reprocess the last interval from the beginning.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# else we reprocess the last interval from the beginning.
# otherwise we reprocess the last interval from the beginning.

# and we pick the default value.
value: >-
[[- if eq .cursor.pagination_finished "true" -]]
# look-back time should only be applied for fresh pagination intervals
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to include comments in the Go template, you will need to use the template comment syntax.

Suggested change
# look-back time should only be applied for fresh pagination intervals
[[- /* look-back time should only be applied for fresh pagination intervals */ -]]

What is the precise definition of "fresh" here? I can see two possible interpretations; one matches the behaviour here (not started but after one that has completed), the other doesn't (never started). The immediately obvious interpretation is the second one, so I think this needs to be clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By fresh pagination cycle I meant a completely new pagination cycle that occurs on every new interval not between pages during a particular interval, I'll make it a bit clearer

@ShourieG
Copy link
Contributor Author

@efd6, addressed all the comments

@ShourieG ShourieG requested a review from efd6 March 3, 2025 03:45
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.

Pending whether this TODO was TODONE and the change below.

@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.25.2"
changes:
- description: Added pagination and cursor fix to mirror the logic for a similar google_workspace scenario in pull - https://github.com/elastic/beats/pull/34274.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- description: Added pagination and cursor fix to mirror the logic for a similar google_workspace scenario in pull - https://github.com/elastic/beats/pull/34274.
- description: Fixed pagination and cursor handling.

(users who want to know about pull requests will know how to find them, presenting them to other people is not really helpful, so instead of putting it here, put it in the commit message or just rely on the discussion in this PR — sorry, I missed this on the first round)

@elasticmachine
Copy link

💚 Build Succeeded

History

cc @ShourieG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Pull request that fixes a bug issue Integration:trend_micro_vision_one Trend Micro Vision One Team:Security-Service Integrations Security Service Integrations Team [elastic/security-service-integrations]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event Loss with Trend Micro Vision One Integration "detections" data stream
3 participants