Skip to content

Fix event handler types filter when using bulk export API#61787

Merged
kshi36 merged 4 commits intomasterfrom
kevin/event-handler-fix
Dec 9, 2025
Merged

Fix event handler types filter when using bulk export API#61787
kshi36 merged 4 commits intomasterfrom
kevin/event-handler-fix

Conversation

@kshi36
Copy link
Copy Markdown
Contributor

@kshi36 kshi36 commented Nov 25, 2025

Fixes #56099

Manual Tests

Test: types filter works correctly for clients using new bulk export API

  • When connected to a storage backend supporting bulk export API (eg. Teleport Cloud, Athena backend), and setting toml configuration file with the following options:
    • Verify types="user.login" filter forwards only user.login events to fluentd audit events endpoint
    • Verify skip-event-types="user.login" filter skips forwarding user.login events to fluentd audit events endpoint
    • Verify skip-session-types="db.session.query" filter skips forwarding db.session.query events to fluentd session events endpoint
    • Verify options above yield same results using both toml config file and CLI arguments

changelog: Fixed bug where event handler types filter is ignored for Teleport clients using Athena storage backend

@kshi36 kshi36 changed the title Fixed event handler types filter when using bulk export API Fix event handler types filter when using bulk export API Nov 25, 2025
@kshi36 kshi36 marked this pull request as ready for review November 25, 2025 20:13
@github-actions github-actions bot added audit-log Issues related to Teleports Audit Log size/md labels Nov 25, 2025
@@ -38,7 +38,6 @@ You may specify configuration options via command line arguments, environment va
| skip-session-types | Comma-separated list of session event types to skip | FDFWD_SKIP_SESSION_TYPES |
| start-time | Minimum event time (RFC3339 format) | FDFWD_START_TIME |
| timeout | Polling timeout | FDFWD_TIMEOUT |
| cursor | Start cursor value | FDFWD_CURSOR |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The cursor CLI option (and environment variable) do not seem to exist anymore

Copy link
Copy Markdown
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

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

Just a small comment in addition to what other people commented on already.

Good job figuring this out @kshi36!

Copy link
Copy Markdown
Contributor

@tigrato tigrato left a comment

Choose a reason for hiding this comment

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

I’m wondering whether we should do the same logic we do in SearchUnstructuredEvents. In that call, we pass the filter types directly to the auth server as a request parameter. Should we do the same here?
It would improve gRPC API throughput and avoid unnecessary unmarshalling and marshalling of events server side that we’ll ultimately discard anyway.

@marcoandredinis marcoandredinis removed their request for review November 26, 2025 13:52
@kshi36
Copy link
Copy Markdown
Contributor Author

kshi36 commented Nov 26, 2025

In that call, we pass the filter types directly to the auth server as a request parameter. Should we do the same here?

I will take a look into this.

@kshi36
Copy link
Copy Markdown
Contributor Author

kshi36 commented Nov 26, 2025

// ExportUnstructuredEvents exports events from a given event chunk returned by GetEventExportChunks. This API prioritizes
// performance over ordering and filtering, and is intended for bulk export of events.
ExportUnstructuredEvents(ctx context.Context, req *auditlogpb.ExportUnstructuredEventsRequest) stream.Stream[*auditlogpb.ExportEventUnstructured]

Based on the documentation on the usage of the bulk export API, it seems to favor not filtering types within ExportUnstructuredEvents. Shall we proceed with filtering types on the server-side after the API call?

@hugoShaka
Copy link
Copy Markdown
Contributor

Shall we proceed with filtering types on the server-side after the API call?

I think that your PR is fine. We do have some stretch goal this quarter to improve event export performance. But before spending more time improving the design for performance, we'll need to measure where we spend time, what is slow, and where we can reap gains.

Tiago is right and we can definitely improve the design here but if this provides a marginal 2% speedup in the general case (very likely as few events are usually filtered) while we could achieve a 30% speedup by fixing something else (and there's a lot to fix 🫠 ) this would not be a very efficient usage of our time.

@kshi36 kshi36 requested review from tigrato and zmb3 December 2, 2025 17:56
@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from bernardjkim December 8, 2025 18:22
@kshi36 kshi36 added this pull request to the merge queue Dec 8, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 8, 2025
@kshi36 kshi36 added this pull request to the merge queue Dec 8, 2025
Merged via the queue into master with commit 50cd404 Dec 9, 2025
46 checks passed
@kshi36 kshi36 deleted the kevin/event-handler-fix branch December 9, 2025 00:05
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@kshi36 See the table below for backport results.

Branch Result
branch/v17 Failed
branch/v18 Failed

kshi36 added a commit that referenced this pull request Dec 9, 2025
* Fixed event handler `types` filter when using bulk export API

* Fix license

* Refactor and remove debug logs

* Fix tests
kshi36 added a commit that referenced this pull request Dec 9, 2025
* Fixed event handler `types` filter when using bulk export API

* Fix license

* Refactor and remove debug logs

* Fix tests
github-merge-queue bot pushed a commit that referenced this pull request Dec 9, 2025
…62082)

* Fixed event handler `types` filter when using bulk export API

* Fix license

* Refactor and remove debug logs

* Fix tests
github-merge-queue bot pushed a commit that referenced this pull request Dec 9, 2025
…62083)

* Fixed event handler `types` filter when using bulk export API

* Fix license

* Refactor and remove debug logs

* Fix tests
21KennethTran pushed a commit that referenced this pull request Jan 6, 2026
* Fixed event handler `types` filter when using bulk export API

* Fix license

* Refactor and remove debug logs

* Fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event Handler types filter should work with new bulk export API

5 participants