Skip to content

Migrate tag option filtering from slicing to MoreSearchAdapter - #26841

Open
danotorrey wants to merge 3 commits into
masterfrom
events-tags-filter-options
Open

Migrate tag option filtering from slicing to MoreSearchAdapter#26841
danotorrey wants to merge 3 commits into
masterfrom
events-tags-filter-options

Conversation

@danotorrey

@danotorrey danotorrey commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

Previously, the Tags filter on the Alerts page loaded its values through POST /events/slices, which executes through the views search engine. SearchExecutionGuard there requires streams:read on the events stream itself, so users whose permissions only cover the events' source streams got a 403 and a broken filter.

This adds POST /events/filter_options, which aggregates distinct tag values directly through MoreSearch — the same source-stream-scoped aggregation path already used in production elsewhere — so visibility is determined by the source streams of the events alone.

The endpoint supports server-side search: the dropdown forwards the typed text as field_query, applied as an include pattern on the terms aggregation (case-insensitive contains; tags are lowercase-normalized at write time). The response returns the 50 most-used values; searching reaches values past the cap, and there's intentionally no truncation indicator in the response.

/events/slices is unchanged, and existing callers of MoreSearch.aggregateSlicesForColumn keep their signature via a delegating overload, so no enterprise changes are needed.

Notes

  • Ordering is most-used-first (the aggregation's natural order). The event-definitions tags endpoint sorts alphabetically instead — top-used seemed more useful for filtering events, happy to align if preferred.
  • Since event tags are unreleased in 7.2, this PR is added to the existing tags changelog entry instead of getting its own.
  • I tested this on my local dev setup running master: a reader user shared on a single stream sees only that stream's tags in the dropdown, searching can't surface tags from streams they can't read, and the same user still gets the 403 on the old /events/slices path. Integration tests for the aggregation run against real OpenSearch 2, OpenSearch 3, and Elasticsearch 7 containers.

Fixes Graylog2/graylog-plugin-enterprise#14282

Assisted with Claude Code

danotorrey and others added 2 commits July 30, 2026 18:06
The tags filter dropdown fetched its values via /events/slices, which goes
through the views search engine and requires streams:read on the events
stream, returning a 403 for users who can only read the events' source
streams.

The new endpoint aggregates distinct tag values directly via MoreSearch,
scoped to the caller's readable source streams. The dropdown's typed text
is forwarded as field_query and applied as a terms-aggregation include
pattern (case-insensitive contains), with the response capped at the 50
most-used values.

Fixes Graylog2/graylog-plugin-enterprise#14282

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@danotorrey danotorrey changed the title Add /events/filter_options with source-stream-scoped tag values Migrate tag filtering from slicing to MoreSearchAdapter Jul 31, 2026
@danotorrey danotorrey changed the title Migrate tag filtering from slicing to MoreSearchAdapter Migrate tag option filtering from slicing to MoreSearchAdapter Jul 31, 2026
@danotorrey
danotorrey marked this pull request as ready for review July 31, 2026 20:50
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 this pull request may close these issues.

1 participant