Skip to content

Commit fffd429

Browse files
committed
Shorten app URL and fix schedule_priority
- Changed app ID from caca-content-activity-checking-application to caca - Updated app.conf, app.manifest, GitHub Actions, PowerShell script - Fixed schedule_priority from invalid 'low' to 'default' in all scheduled searches - Updated README with corrected app context syntax (caca: instead of long form) - Added test-environment.yaml with auto-generated random passwords - New app URL will be /app/caca/ instead of long form
1 parent 568a474 commit fffd429

File tree

7 files changed

+275
-14
lines changed

7 files changed

+275
-14
lines changed

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ jobs:
213213
run: |
214214
echo "Running Splunk AppInspect..."
215215
# Create a temporary package directory
216-
PACKAGE_DIR="caca-content-activity-checking-application"
216+
PACKAGE_DIR="caca"
217217
mkdir -p "$PACKAGE_DIR"
218218
219219
# Copy app files excluding development files

README.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ The `caca_metrics` index should be created automatically. Verify by running:
119119

120120
### 2. Populate Dashboard Registry
121121

122-
Run the registry update search to populate the dashboard registry:
122+
Run the registry update search to populate the dashboard registry. **Important:** Make sure to run this search from within the CACA app context, or use the full app path in the outputlookup command:
123+
124+
**Option A - Run from CACA app context:**
125+
Navigate to **CACA app** in Splunk Web, then run:
123126

124127
```spl
125128
| rest /services/data/ui/views splunk_server=local count=0 search="sharing=*"
@@ -135,16 +138,43 @@ Run the registry update search to populate the dashboard registry:
135138
| outputlookup dashboard_registry.csv
136139
```
137140

141+
**Option B - Run from any app:**
142+
143+
If you prefer to run the search from a different app (like Search & Reporting), you can do so, but you **must** include the full app path in the outputlookup command:
144+
145+
```spl
146+
| rest /services/data/ui/views splunk_server=local count=0 search="sharing=*"
147+
| search isDashboard=1 OR isVisible=1
148+
| eval dashboard_uri="/app/".eai:acl.app."/".title
149+
| eval pretty_name=coalesce(label, title)
150+
| eval app=eai:acl.app
151+
| eval owner=eai:acl.owner
152+
| eval sharing=eai:acl.sharing
153+
| eval description=coalesce(eai:data, "")
154+
| eval status="active"
155+
| table dashboard_uri pretty_name app owner sharing description status
156+
| outputlookup caca:dashboard_registry.csv
157+
```
158+
159+
**Note:** The `caca:` prefix ensures the lookup is saved to the correct app even when running from elsewhere.
160+
161+
**Recommended:** Just use Option A - it's simpler and less error-prone.
162+
138163
This will scan your Splunk environment and populate the `dashboard_registry.csv` lookup with all discovered dashboards, including private dashboards.
139164

140165
**Note on Private Dashboards:** The `search="sharing=*"` parameter ensures that dashboards with all sharing levels (global, app, and user/private) are included in the registry. To see private dashboards owned by other users, the scheduled search must run with appropriate permissions (typically as admin or with the `list_storage_passwords` capability).
141166

142-
**Verify the registry:**
167+
**Verify the registry (run from CACA app):**
143168

144169
```spl
145170
| inputlookup dashboard_registry | stats count
146171
```
147172

173+
Or from any app, navigate to the lookup location:
174+
```spl
175+
Settings → Lookups → Lookup table files → Find "dashboard_registry.csv" in caca
176+
```
177+
148178
### 3. Enable Scheduled Searches
149179

150180
Navigate to **Settings → Searches, reports, and alerts** and enable these searches:
@@ -462,7 +492,11 @@ Edit `lookups/dashboard_registry.csv` and set `status=inactive` for specific das
462492

463493
### Dashboard Not Appearing in Registry
464494

465-
Run the registry update search manually:
495+
Run the registry update search manually from the CACA app context:
496+
497+
**Step 1:** Navigate to the CACA app in Splunk Web
498+
499+
**Step 2:** Run this search:
466500
```spl
467501
| rest /services/data/ui/views splunk_server=local count=0 search="sharing=*"
468502
| search isDashboard=1 OR isVisible=1
@@ -473,12 +507,12 @@ Run the registry update search manually:
473507
| eval sharing=eai:acl.sharing
474508
| eval status="active"
475509
| table dashboard_uri pretty_name app owner sharing status
476-
| outputlookup dashboard_registry.csv
510+
| outputlookup caca:dashboard_registry.csv
477511
```
478512

479513
**For Private Dashboards:** If private dashboards still don't appear, ensure the search is running with appropriate permissions. Private dashboards owned by other users require admin privileges or specific capabilities to be discovered via REST API.
480514

481-
Or add it manually to `lookups/dashboard_registry.csv`.
515+
Or add it manually to `lookups/dashboard_registry.csv` in the CACA app directory.
482516

483517
### Metrics Showing Zero
484518

app.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"title": "CACA - Content Activity Checking Application",
55
"id": {
66
"group": null,
7-
"name": "caca-content-activity-checking-application",
7+
"name": "caca",
88
"version": "0.0.1"
99
},
1010
"author": [

default/app.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ description = CACA (Content Activity Checking Application) - Track usage, health
1111
version = 0.0.1
1212

1313
[package]
14-
id = caca-content-activity-checking-application
14+
id = caca
1515
check_for_updates = 1

default/savedsearches.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ search = index=_internal sourcetype=splunkd_access method=GET uri_path="/*/app/*
2222
| eval metric_name="dashboard.views" \
2323
| eval activity_type="view" \
2424
| mcollect index=caca_metrics metric_name=metric_name pretty_name app user activity_type split=t
25-
schedule_priority = low
25+
schedule_priority = default
2626
schedule_window = 5
2727

2828
[Dashboard Edits - Metrics Collector]
@@ -42,7 +42,7 @@ search = index=_audit action=edit_view OR action=create_view object_type=view \
4242
| eval metric_name="dashboard.edits" \
4343
| eval activity_type=if(action="create_view", "create", "edit") \
4444
| mcollect index=caca_metrics metric_name=metric_name pretty_name app user activity_type split=t
45-
schedule_priority = low
45+
schedule_priority = default
4646
schedule_window = 5
4747

4848
[Dashboard Health - Metrics Collector]
@@ -66,7 +66,7 @@ search = index=_internal (sourcetype=splunkd log_level=ERROR OR log_level=WARN)
6666
| eval severity=lower(log_level) \
6767
| eval activity_type="health" \
6868
| mcollect index=caca_metrics metric_name=metric_name pretty_name app severity activity_type split=t
69-
schedule_priority = low
69+
schedule_priority = default
7070
schedule_window = 5
7171

7272
[Dashboard Performance - Metrics Collector]
@@ -90,7 +90,7 @@ search = index=_internal sourcetype=splunkd_ui_access uri_path="/*/app/*" \
9090
| eval metric_name="dashboard.load_time" \
9191
| eval activity_type="performance" \
9292
| mcollect index=caca_metrics metric_name=metric_name _value=avg_load_time pretty_name app user activity_type split=t
93-
schedule_priority = low
93+
schedule_priority = default
9494
schedule_window = 5
9595

9696
#####################
@@ -119,4 +119,4 @@ search = | rest /services/data/ui/views splunk_server=local count=0 search="shar
119119
| fields - include \
120120
| table dashboard_uri pretty_name app owner sharing description status \
121121
| outputlookup dashboard_registry.csv
122-
schedule_priority = low
122+
schedule_priority = default

local/test-environment.yaml

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
# Test Environment for CACA Splunk App
2+
# This is a generic Kubernetes deployment for testing the CACA app
3+
# Customize the namespace, ingress, and other settings for your environment
4+
#
5+
# To retrieve the generated Splunk password after deployment:
6+
# kubectl get secret splunk-secret -n <your-namespace> -o jsonpath='{.data.password}' | base64 -d
7+
8+
---
9+
# Job to generate a random password for Splunk
10+
# This runs before the deployment and creates/updates the secret with a random password
11+
apiVersion: batch/v1
12+
kind: Job
13+
metadata:
14+
name: splunk-password-generator
15+
namespace: default # Change to your namespace
16+
spec:
17+
ttlSecondsAfterFinished: 100 # Auto-cleanup after 100 seconds
18+
template:
19+
spec:
20+
serviceAccountName: default # Ensure the service account has permission to create secrets
21+
restartPolicy: Never
22+
containers:
23+
- name: generate-password
24+
image: bitnami/kubectl:latest
25+
command:
26+
- /bin/bash
27+
- -c
28+
- |
29+
# Generate a random 16-character password
30+
PASSWORD=$(cat /dev/urandom | tr -dc 'A-Za-z0-9!@#$%^&*' | head -c 16)
31+
32+
# Create or update the secret
33+
kubectl create secret generic splunk-secret \
34+
--from-literal=password="$PASSWORD" \
35+
--dry-run=client -o yaml | kubectl apply -f -
36+
37+
echo "Password secret created/updated successfully"
38+
echo "Retrieve with: kubectl get secret splunk-secret -o jsonpath='{.data.password}' | base64 -d"
39+
---
40+
apiVersion: apps/v1
41+
kind: Deployment
42+
metadata:
43+
name: splunk
44+
labels:
45+
app: splunk
46+
namespace: default # Change to your namespace
47+
spec:
48+
replicas: 1
49+
strategy:
50+
type: RollingUpdate
51+
rollingUpdate:
52+
maxSurge: 1
53+
maxUnavailable: 1
54+
selector:
55+
matchLabels:
56+
app: splunk
57+
template:
58+
metadata:
59+
labels:
60+
app: splunk
61+
spec:
62+
hostname: splunk
63+
initContainers:
64+
- name: download-caca-app
65+
image: alpine/git:latest
66+
securityContext:
67+
runAsUser: 0 # Run as root to ensure write permissions
68+
env:
69+
# Change this to use a different branch (e.g., dev, feature/my-feature)
70+
- name: CACA_BRANCH
71+
value: "main"
72+
# Optionally override the GitHub repo URL
73+
# - name: CACA_REPO_URL
74+
# value: "https://github.com/yourusername/your-fork.git"
75+
command:
76+
- sh
77+
- -c
78+
- |
79+
set -e # Exit on any error
80+
81+
REPO_URL="${CACA_REPO_URL:-https://github.com/devinslick/splunk-content-monitoring-console.git}"
82+
83+
echo "=== CACA App Installation Starting ==="
84+
echo "Repository: ${REPO_URL}"
85+
echo "Branch: ${CACA_BRANCH}"
86+
echo "Target: /opt/splunk/etc/apps/caca"
87+
88+
echo "Checking volume mount..."
89+
ls -la /opt/splunk/etc/ || echo "WARNING: /opt/splunk/etc/ not accessible"
90+
91+
echo "Creating apps directory if needed..."
92+
mkdir -p /opt/splunk/etc/apps
93+
94+
echo "Removing old CACA app installation (if exists)..."
95+
rm -rf /opt/splunk/etc/apps/caca-content-activity-checking-application
96+
rm -rf /opt/splunk/etc/apps/caca
97+
98+
echo "Downloading CACA app from GitHub (branch: ${CACA_BRANCH})..."
99+
cd /tmp
100+
git clone --depth 1 --branch ${CACA_BRANCH} ${REPO_URL}
101+
102+
echo "Creating app directory..."
103+
mkdir -p /opt/splunk/etc/apps/caca
104+
105+
echo "Copying app files (excluding dev files)..."
106+
cd splunk-content-monitoring-console
107+
108+
# Copy all files except dev-specific ones
109+
find . -maxdepth 1 -mindepth 1 \
110+
! -name '.git*' \
111+
! -name 'local' \
112+
! -name 'devnotes' \
113+
! -name '.venv' \
114+
! -name '.pytest_cache' \
115+
! -name '.pre-commit-config.yaml' \
116+
! -name '.bandit.yml' \
117+
! -name 'CI-CD-SETUP.md' \
118+
! -name 'scripts' \
119+
! -name 'appinspect_report.json' \
120+
! -name '*.pyc' \
121+
! -name '__pycache__' \
122+
-exec cp -r {} /opt/splunk/etc/apps/caca/ \;
123+
124+
echo "Setting permissions for Splunk user (41812)..."
125+
chown -R 41812:41812 /opt/splunk/etc/apps/caca
126+
127+
echo "=== CACA App Installation Complete ==="
128+
echo "Installed files:"
129+
ls -la /opt/splunk/etc/apps/caca/
130+
131+
echo "SUCCESS: CACA app installed from ${REPO_URL} (branch: ${CACA_BRANCH})"
132+
volumeMounts:
133+
- mountPath: /opt/splunk/etc/apps
134+
name: splunk
135+
subPath: var/splunk-apps # Use a dedicated path in the PVC
136+
containers:
137+
- name: splunk
138+
image: splunk/splunk:latest
139+
imagePullPolicy: Always
140+
ports:
141+
- containerPort: 8000
142+
name: http
143+
protocol: TCP
144+
- containerPort: 8088
145+
name: hec
146+
protocol: TCP
147+
- containerPort: 9997
148+
name: indexer
149+
protocol: TCP
150+
volumeMounts:
151+
- mountPath: /opt/splunk/var
152+
name: splunk
153+
subPath: var
154+
- mountPath: /opt/splunk/etc/apps
155+
name: splunk
156+
subPath: var/splunk-apps # Share same PVC, different subPath
157+
env:
158+
- name: TZ
159+
value: 'America/Chicago' # Change to your timezone
160+
- name: SPLUNK_GENERAL_TERMS
161+
value: '--accept-sgt-current-at-splunk-com'
162+
- name: SPLUNK_START_ARGS
163+
value: '--accept-license --no-prompt --answer-yes'
164+
- name: SPLUNK_HTTP_PORT
165+
value: "8000"
166+
- name: SPLUNK_HEC_PORT
167+
value: "8088"
168+
- name: SPLUNK_PASSWORD
169+
valueFrom:
170+
secretKeyRef:
171+
name: splunk-secret
172+
key: password
173+
livenessProbe:
174+
httpGet:
175+
path: /
176+
port: 8000
177+
initialDelaySeconds: 60
178+
periodSeconds: 30
179+
volumes:
180+
- name: splunk
181+
persistentVolumeClaim:
182+
claimName: splunk # Change to your PVC name
183+
---
184+
apiVersion: v1
185+
kind: Service
186+
metadata:
187+
name: splunk-http
188+
namespace: default # Change to your namespace
189+
labels:
190+
app: splunk
191+
spec:
192+
ports:
193+
- name: http
194+
port: 8000
195+
type: ClusterIP
196+
selector:
197+
app: splunk
198+
---
199+
apiVersion: v1
200+
kind: Service
201+
metadata:
202+
name: splunk-hec
203+
namespace: default # Change to your namespace
204+
labels:
205+
app: splunk
206+
spec:
207+
ports:
208+
- name: hec
209+
port: 8088
210+
type: ClusterIP
211+
selector:
212+
app: splunk
213+
---
214+
apiVersion: v1
215+
kind: Service
216+
metadata:
217+
name: splunk-indexer
218+
namespace: default # Change to your namespace
219+
labels:
220+
app: splunk
221+
spec:
222+
ports:
223+
- name: indexer
224+
port: 9997
225+
type: ClusterIP
226+
selector:
227+
app: splunk

scripts/validate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ if (-not $Quick) {
349349

350350
try {
351351
# Create temporary package directory
352-
$packageDir = Join-Path $env:TEMP "caca-content-activity-checking-application-$(Get-Date -Format 'yyyyMMddHHmmss')"
352+
$packageDir = Join-Path $env:TEMP "caca-$(Get-Date -Format 'yyyyMMddHHmmss')"
353353
New-Item -ItemType Directory -Path $packageDir -Force | Out-Null
354354

355355
# Copy files (exclude dev files)

0 commit comments

Comments
 (0)