Skip to content

feat: add opt-in namespaced search with wildcards for cross-app/owner alerts - #35

Merged
Rolf Håvard Blindheim (rhblind) merged 4 commits into
mainfrom
fix-splunk-job-namespace
Aug 31, 2026
Merged

feat: add opt-in namespaced search with wildcards for cross-app/owner alerts#35
Rolf Håvard Blindheim (rhblind) merged 4 commits into
mainfrom
fix-splunk-job-namespace

Conversation

@rhblind

Copy link
Copy Markdown
Member

Summary

  • Adds an opt-in use_wildcard_namespace config option to OffBroadway.Splunk.Producer. When enabled, receive_messages requests job results against the wildcard /servicesNS/-/- namespace instead of /services, fixing 404 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.
  • Defaults to false, fully backward compatible.

Root cause

Production alerts were failing with {:stream_error, :internal_error} and 404 errors because the default /services namespace resolves relative to the API token's own user and default app. Alerts living in a different app (e.g. isoc vs. the token's default search) were unreachable. Confirmed live against a real cross-app alert: went from 400/404 to 200 with full job history and successful message delivery.

Test plan

  • mix test (51 tests, 0 failures)
  • mix format --check-formatted
  • mix credo --strict (0 issues)
  • mix dialyzer (0 errors)
  • Verified live against a production cross-app Splunk alert (isoc app vs. default search app) via a running node — pipeline dashboard confirmed 100% message delivery

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

LGTM

@rhblind
Rolf Håvard Blindheim (rhblind) merged commit 956b875 into main Aug 31, 2026
11 checks passed
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