Skip to content

panw_cortex_xdr: fix alerts CEL pagination getting stuck#18195

Merged
efd6 merged 1 commit intoelastic:mainfrom
efd6:s7056-panw_cortex_xdr
Apr 7, 2026
Merged

panw_cortex_xdr: fix alerts CEL pagination getting stuck#18195
efd6 merged 1 commit intoelastic:mainfrom
efd6:s7056-panw_cortex_xdr

Conversation

@efd6
Copy link
Copy Markdown
Contributor

@efd6 efd6 commented Apr 1, 2026

Proposed commit message

panw_cortex_xdr: fix alerts CEL pagination getting stuck

The alerts CEL program had two interacting bugs that caused the
pagination offset to accumulate beyond total_count and never reset,
stalling ingestion indefinitely.

1. search_from/search_to used optional.none() to clear, but
   state.with() preserves keys absent from the overlay. Replace
   with explicit 0 values and gate the request body on want_more.

2. When pagination completed with zero alerts, last_timestamp
   stayed frozen and the same time window re-opened every interval.
   Advance the cursor to filter_time on terminal pagination.

Additionally, sort_time_field was creation_time while
filter_time_field was server_creation_time, forcing cross-joins on
the Palo Alto side. Align both to server_creation_time.

The error path now also resets search_from, search_to, and
want_more explicitly so stale pagination state does not survive
API errors.

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

@efd6 efd6 self-assigned this Apr 1, 2026
@efd6 efd6 added Integration:panw_cortex_xdr Palo Alto Cortex XDR bugfix Pull request that fixes a bug issue Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] labels Apr 1, 2026
The alerts CEL program had two interacting bugs that caused the
pagination offset to accumulate beyond total_count and never reset,
stalling ingestion indefinitely.

1. search_from/search_to used optional.none() to clear, but
   state.with() preserves keys absent from the overlay. Replace
   with explicit 0 values and gate the request body on want_more.

2. When pagination completed with zero alerts, last_timestamp
   stayed frozen and the same time window re-opened every interval.
   Advance the cursor to filter_time on terminal pagination.

Additionally, sort_time_field was creation_time while
filter_time_field was server_creation_time, forcing cross-joins on
the Palo Alto side. Align both to server_creation_time.

The error path now also resets search_from, search_to, and
want_more explicitly so stale pagination state does not survive
API errors.
@efd6 efd6 force-pushed the s7056-panw_cortex_xdr branch from ebc15c0 to 61a788e Compare April 1, 2026 22:31
@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@elasticmachine
Copy link
Copy Markdown

💚 Build Succeeded

cc @efd6

@efd6 efd6 marked this pull request as ready for review April 1, 2026 23:01
@efd6 efd6 requested a review from a team as a code owner April 1, 2026 23:01
@elasticmachine
Copy link
Copy Markdown

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

@efd6 efd6 merged commit a2d743f into elastic:main Apr 7, 2026
9 checks passed
@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

Package panw_cortex_xdr - 2.5.2 containing this change is available at https://epr.elastic.co/package/panw_cortex_xdr/2.5.2/

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:panw_cortex_xdr Palo Alto Cortex XDR Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

Projects

None yet

3 participants