Repository navigation
Conversation
Add a WORKLOAD_MANAGEMENT_ACTION audit event, raised when a workload group refuses a search at admission or cancels one while it is running. The events are produced by consuming the node-local notifier added in core. Delivery uses a bounded single-threaded queue so no audit-sink work runs on the thread that rejected or cancelled. Overflow is counted and logged. The category is disabled by default. The two sources carry different context. A rejection is raised on the request's own thread, so it has the authenticated user, the origin and the request id, and correlates with that request's other audit records. A cancellation is raised from the workload management scheduler on the generic thread pool and has none of those; it carries the task id instead. No audit-sink suppression marker is needed, because workload management governs only search tasks and so cannot act on the audit sink's own index writes. For the same reason events with an unknown origin are recorded rather than skipped: for workload management that is the cancellation path. Signed-off-by: Jialiang Liang <jiallian@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
WORKLOAD_MANAGEMENT_ACTIONevents.The two sources are not symmetric, and this is the main thing to review
GENERICaudit_request_idA rejection is therefore a well-correlated event: it joins the
AUTHENTICATEDrecord for the same request throughaudit_request_id, so the query text and index are recoverable from that record when request-body logging is enabled.A cancellation is not.
WorkloadGroupServicecancels fromthreadPool.scheduleWithFixedDelay(..., ThreadPool.Names.GENERIC), so there is no request context to read — no user, no origin, no request id. The event carries the task id instead. Joining that back to the originating request needsaudit_trace_task_id, which only appears when transport-layer auditing is enabled. Propagating bounded correlation context into the cancellation path is core work and is the obvious follow-up; it is deliberately not attempted here.No audit-sink recursion guard, unlike the circuit breaker equivalent
cwperks#151 needs a self-suppression marker because a circuit breaker can trip on the audit sink's own index write. Workload management governs only
SearchTaskandSearchShardTask, so it can never act on an index write, and no marker is required. For the same reason this draft does not skip events with an unknown origin: for workload management, unknown origin is the cancellation path rather than a possible audit-sink write, and skipping it would discard exactly the events the feature exists for.Example audit documents
A rejection, with caller and request id available:
{ "audit_category": "WORKLOAD_MANAGEMENT_ACTION", "audit_request_effective_user": "alice", "audit_request_id": "6Zz0D6IB46_N3ehSzqW3", "audit_request_origin": "REST", "audit_wlm_action": "REJECTED", "audit_wlm_workload_group_id": "wg-analytics", "audit_wlm_resiliency_mode": "ENFORCED", "audit_wlm_resource_type": "CPU", "audit_wlm_resource_threshold": 0.8, "audit_wlm_resource_usage": 0.95 }A cancellation, with no request context:
{ "audit_category": "WORKLOAD_MANAGEMENT_ACTION", "audit_wlm_action": "CANCELLED", "audit_wlm_workload_group_id": "wg-analytics", "audit_wlm_task_id": 1042 }The timestamp is when the asynchronous worker creates the message, not the exact moment of the action.
Draft limitations and follow-up
Issues Resolved
None.
Testing
./gradlew compileJavaagainst a locally published core build containing the notifier — passed../gradlew spotlessApply test --tests 'org.opensearch.security.auditlog.impl.WorkloadManagementAuditListenerTest'— passed.Check List
--signoffBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.