feat: add opt-in namespaced search with wildcards for cross-app/owner alerts - #35
Merged
Merged
Conversation
Requests to /services/... resolve against the API token's own default app, so jobs and saved searches living in a different app (e.g. isoc) fail with 404 "Unknown sid" even when the token owns the job. Setting use_wildcard_namespace: true routes both the history and results requests through /servicesNS/-/- instead. Defaults to false to preserve existing behavior.
…n wildcarding
Splunk rejects wildcarded owner/app on the saved-search history
sub-resource outright, unlike other endpoints. When
use_wildcard_namespace is enabled, receive_status now resolves the
search's real app via a wildcard-tolerant lookup first, then requests
history from a concrete /servicesNS/nobody/{app} namespace.
Confirmed live against a cross-app alert (400 -> 200 with full job
history). receive_messages is unaffected since Splunk's job-results
endpoint has no such restriction.
Rolf Håvard Blindheim (rhblind)
left a comment
Member
Author
There was a problem hiding this comment.
LGTM
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.
Summary
use_wildcard_namespaceconfig option toOffBroadway.Splunk.Producer. When enabled,receive_messagesrequests job results against the wildcard/servicesNS/-/-namespace instead of/services, fixing404 Unable to fetch events from Splunk SID ...errors that occur when an alert's saved search lives in a different Splunk app or is owned by a different user than the API token.receive_status(saved-search history) can't use the same wildcard directly — Splunk hard-rejects wildcarded owner/app on that specific sub-resource (400 Cannot get history of a saved search for wildcarded users or applications). Instead, when wildcarding is enabled, it first resolves the search's real app via a wildcard-tolerant lookup, then requests history from a concrete/servicesNS/nobody/{app}namespace.false, fully backward compatible.Root cause
Production alerts were failing with
{:stream_error, :internal_error}and404errors because the default/servicesnamespace resolves relative to the API token's own user and default app. Alerts living in a different app (e.g.isocvs. the token's defaultsearch) were unreachable. Confirmed live against a real cross-app alert: went from400/404to200with full job history and successful message delivery.Test plan
mix test(51 tests, 0 failures)mix format --check-formattedmix credo --strict(0 issues)mix dialyzer(0 errors)isocapp vs. defaultsearchapp) via a running node — pipeline dashboard confirmed 100% message delivery