Splunk observability k8s frontend rum setup

From chambear2809/splunk-cisco-skills · View interactive version

Splunk observability k8s frontend rum setup is an AI agent skill from the GitHub repository chambear2809/splunk-cisco-skills. Use when wiring a React, Vue, Angular, Next.js, Nuxt, Remix, nginx/httpd, SPA, or MPA frontend to Splunk Browser RUM, enabling Session Replay, configuring Frustration Signals, preparing browser-side Digital Experience Analytics (DXA), uploading source maps, validating trace linking, or uninstalling

How to use this skill

Skill file

Splunk Observability Kubernetes Frontend RUM + Session Replay

Prerequisites

| Tool or access | Purpose | Verify |

|---|---|---|

| Bash and Python 3 | Run bundled setup and validation helpers | bash --version && python3 --version |

| Required product/platform access | Inspect or configure the selected target | Complete the documented preflight |

| Credential files for live modes | Keep secrets out of chat | Verify paths only |

Workflow Overview

┌───────────┐   ┌───────────────┐   ┌───────────────┐   ┌─────────────────┐
│ Preflight │ → │ Render/review │ → │ Apply/handoff │ → │ Validate evidence │
└───────────┘   └───────────────┘   └───────────────┘   └─────────────────┘

When to Activate

enabling Session Replay, configuring Frustration Signals, preparing browser-side Digital Experience Analytics

(DXA), uploading.

Scope

Follow the documented read-only or render-first path whenever it is available.

This skill does not imply permission to mutate live systems. Require explicit

apply flags, protected credentials, and operator review for state changes.

Examples

Inspect the supported setup modes before selecting one:

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/setup.sh --help

Expected output: usage, supported modes, and required arguments are displayed

without changing the target environment.

Inspect validation modes before running completion checks:

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/validate.sh --help

Expected output: offline, live, and completion options are displayed when the

skill supports them; help exits without mutation.

Troubleshooting

| Issue | Cause | Resolution |

|---|---|---|

| Preflight fails | A required tool or access path is missing | Resolve it before rendering or applying |

| Rendered assets are incomplete | Required non-secret inputs are absent | Complete intake and render again |

| Apply is blocked | Review, credentials, or explicit acceptance is missing | Use the documented handoff |

| Validation is incomplete | Live evidence is unavailable | Record the gap and keep completion open |

This skill configures Splunk Browser RUM (@splunk/otel-web 2.x) plus optional Session Replay (Splunk recorder) for frontend applications served from Kubernetes pods. It is a standalone reusable skill: Splunk Browser RUM beacons land directly at rum-ingest.<realm>.observability.splunkcloud.com/v1/rum, so the Splunk OTel Collector is not a prerequisite for the browser side. Use it as the browser instrumentation handoff when a Digital Experience Analytics (DXA) request needs RUM agent setup, source maps, user tracking, session replay, or frustration signals.

Disambiguation: this is Splunk Browser RUM, not AppDynamics BRUM. AppDynamics Browser Real User Monitoring is handled by splunk-appdynamics-eum-setup. The two products and their SDKs are distinct.

Architecture: four injection modes

flowchart TD
    spec["template.example<br/>or --guided prompts"] --> render[render_assets.py]
    render --> preflight{preflight}
    preflight -->|HTTPS check<br/>version pin<br/>distroless detect<br/>ingress-nginx CVE check| mode{injection mode}
    mode -->|A.i nginx pod-side| nginxCm["nginx-rum-configmap.yaml<br/>+ deployment-patch.yaml<br/>sub_filter on closing head"]
    mode -->|A.ii ingress-nginx| ingressCm["ingress-snippet-patch.yaml<br/>configuration-snippet annotation<br/>requires allow-snippet-annotations:true"]
    mode -->|C initContainer| initCm["initcontainer-patch.yaml<br/>busybox sed rewriter<br/>+ shared emptyDir<br/>distroless-safe"]
    mode -->|B runtime-config| runtimeCm["runtime-config-configmap.yaml<br/>window.SPLUNK_RUM_CONFIG<br/>+ deployment-patch.yaml<br/>for npm-bundled apps"]
    nginxCm --> backup[injection-backup-configmap.yaml]
    ingressCm --> backup
    initCm --> backup
    runtimeCm --> backup
    backup --> apply[apply-injection.sh]
    apply --> verify["verify-injection.sh<br/>+ --check-server-timing for RUM-to-APM"]

Istio EnvoyFilter / Lua body-rewrite injection is intentionally not rendered. Service-mesh users can use mode A.i (pod-side nginx) like everyone else.

What it renders

There is no handoff-base-collector.sh because RUM beacons direct to ingest.

Safety Rules

Primary Workflow

  1. (Optional) Discover frontend workload candidates. Read-only, no mutation:

```bash

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/setup.sh \

--discover-frontend-workloads \

--realm us0

```

Edit splunk-observability-k8s-frontend-rum-rendered/discovery/workloads.yaml to set per-workload injection_mode.

  1. Render the assets:

```bash

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/setup.sh \

--render \

--realm us0 \

--application-name acme-checkout \

--deployment-environment prod \

--version "${APP_VERSION:?set application version}" \

--workload Deployment/prod/checkout-web=nginx-configmap

```

  1. Or run guided mode. Walks the operator through every SplunkRum.init knob, every Session Replay knob, every Frustration Signals knob, then writes a spec and renders:

```bash

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/setup.sh --guided

```

  1. Review splunk-observability-k8s-frontend-rum-rendered/:
  1. Apply (gated):

```bash

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/setup.sh \

--apply-injection \

--accept-frontend-injection

```

  1. Verify:

```bash

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/validate.sh \

--live --check-injection https://checkout.example.com

```

Injection Modes

| Mode | When to pick | Pod changes | Ingress changes |

|------|--------------|-------------|-----------------|

| A.i nginx-configmap | Frontend served by nginx in the pod (most React/Vue/Angular SPA dist on nginx:alpine). Default. | Mount ConfigMap into /etc/nginx/conf.d/. Rollout restart. | None |

| A.ii ingress-snippet | Cluster runs ingress-nginx and operator owns the Ingress object. Requires allow-snippet-annotations: "true" on the controller (default false since CVE-2021-25742). | None | Patch annotation on the Ingress |

| C init-container | Distroless or non-nginx static-file server (httpd, busybox-served, custom). Works with any frontend container. | Add initContainer + shared emptyDir. Rollout restart. | None |

| B runtime-config | App already bundles @splunk/otel-web via npm and just needs realm + token + applicationName at runtime. | Mount ConfigMap of window.SPLUNK_RUM_CONFIG. Rollout restart. | None |

See references/injection-modes.md for the deep dive (gzip pitfall, distroless caveats, nginx vs nginx-unprivileged conf.d paths, ingress-nginx CVE history).

Session Replay

Enterprise-tier feature. Default off. To enable:

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/setup.sh \
  --render \
  --enable-session-replay \
  --accept-session-replay-enterprise \
  --session-replay-sampler-ratio 0.5

Renders the splunk-otel-web-session-recorder.js script tag and a SplunkSessionRecorder.init(...) call with the new Splunk recorder format (recorder: 'splunk'). The renderer surfaces every privacy and feature knob: maskAllInputs, maskAllText, sensitivityRules[], maxExportIntervalMs, sampler.ratio, features.{canvas, video, iframes, packAssets, cacheAssets, backgroundServiceSrc}. See references/session-replay-privacy.md and the rrweb→Splunk recorder migration table.

Frustration Signals 2.0

The skill exposes the full Frustration Signals 2.0 surface. rageClick is on by default; deadClick, errorClick, and thrashedCursor are opt-in. thrashedCursor has 14 tuning knobs (timeWindowMs, throttleMs, minDirectionChanges, etc.). See references/frustration-signals.md.

Manual Instrumentation

Manual instrumentation hooks (custom workflow spans for the DEA Custom Events tab, SplunkRum.setGlobalAttributes(), enduser.id / enduser.role, per-framework error handlers for React / Vue 2/3 / Angular 1/2+ / Ember) are documented in references/manual-instrumentation.md. The skill renders advisory snippets only; integrating them is the operator's responsibility.

Source Maps

When source_maps.enabled: true (default), the skill renders a source-maps/sourcemap-upload.sh helper plus sample CI snippets. The helper wraps the splunk-rum CLI:

splunk-rum sourcemaps inject --path dist
splunk-rum sourcemaps upload --path dist --app-name "$APP_NAME" --app-version "$APP_VERSION"

Source map upload requires the Org Access Token (SPLUNK_O11Y_TOKEN_FILE), not the RUM token. See references/source-maps.md.

RUM-to-APM Linking

Splunk Browser RUM links front-end traces to back-end APM traces via the Server-Timing: traceparent;desc="00-{trace_id}-{span_id}-01" HTTP response header on backend responses. Backends instrumented via splunk-observability-k8s-auto-instrumentation-setup emit the header automatically. CORS callers need Access-Control-Expose-Headers: Server-Timing. The validation surface includes --check-server-timing <backend-url>; if the backend is missing the header, the skill emits handoff-auto-instrumentation.sh pointing at the auto-instrumentation skill. See references/apm-linking.md.

Hand-offs

Out of scope

Validation

bash skills/splunk-observability-k8s-frontend-rum-setup/scripts/validate.sh

Static checks cover:

With --live:

See reference.md for the full CLI flag reference and the thirteen references/*.md annexes for deep topical documentation.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.