Skip to content

Allows filtering of streaming audit events

Harsimar Sandhu requested to merge 344845-filter-audit-events-for-streaming into master

What does this MR do and why?

Adds filtering capability in audit event streaming. No filters means all the events will be streamed. When a filter is present, only events having this filter will stream.

How to set up and validate locally

  1. Add https://docs.gitlab.com/ee/administration/audit_event_streaming.html#use-the-gitlab-ui on a group
  2. Check audit event streaming is working. (try downloading a project with zip download button it produces event: 'repository_download_operation')
  3. Enable feature flag using rails console Feature.enable(:allow_audit_event_type_filtering)
  4. Check again if audit event streaming is working.
  5. Now add a filter for the destination we created in step 1 for this use rails console:
destination = AuditEvents::ExternalAuditEventDestination.last
destination.event_type_filters.create(audit_event_type: 'repository_download_operation')
  1. Now again try to stream audit event, it will stream if filter you have created has same audit_event_type as the event we are streaming and will not stream if it's different.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #344845 (closed)

Edited by Harsimar Sandhu

Merge request reports