Skip to content

Commit 37b66ae

Browse files
Copilotdevinslick
andcommitted
Add app filtering capability for selective monitoring
Co-authored-by: devinslick <[email protected]>
1 parent f329796 commit 37b66ae

File tree

6 files changed

+154
-3
lines changed

6 files changed

+154
-3
lines changed

README.md

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ Replace `YOUR_DASHBOARD_NAME` with your dashboard's pretty name from the registr
212212

213213
CACA provides several search macros for easy querying. These macros help you quickly identify dashboards with issues, analyze performance, and understand usage patterns.
214214

215+
**Note:** All macros respect the app filter configuration (see "Filtering Apps for Monitoring" in Configuration section). All results include the `app` field showing which app each dashboard belongs to, making it easy to filter or group results by application.
216+
215217
#### Finding Dashboards with Issues
216218

217219
##### Identify dashboards with health issues (errors/warnings):
@@ -293,6 +295,20 @@ CACA provides several search macros for easy querying. These macros help you qui
293295
| where health_status="critical" OR (errors_7d > 50) OR (avg_load_time_7d > 10000)
294296
```
295297

298+
**Filter results by specific app:**
299+
```spl
300+
`get_dashboards_with_errors`
301+
| where app="search"
302+
| table pretty_name app errors warnings health_status
303+
```
304+
305+
**List dashboards with errors across multiple apps:**
306+
```spl
307+
`get_dashboards_with_errors`
308+
| where app IN ("my_app1", "my_app2", "production_app")
309+
| sort -errors
310+
```
311+
296312
**List dashboards with errors that are actively used:**
297313
```spl
298314
`get_dashboards_with_errors`
@@ -339,9 +355,70 @@ Edit `default/indexes.conf` to adjust retention:
339355
frozenTimePeriodInSecs = 31536000 # 1 year (default)
340356
```
341357

342-
### Excluding Dashboards from Monitoring
358+
### Filtering Apps for Monitoring
359+
360+
CACA can be configured to only monitor dashboards from specific apps, or exclude certain apps from monitoring. This is useful when you only want to track dashboards in production apps, or exclude system/admin apps.
361+
362+
#### Configuration Method
363+
364+
Edit `lookups/app_filter.csv` to control which apps are monitored:
365+
366+
**Include specific apps only:**
367+
```csv
368+
app,include
369+
search,true
370+
my_production_app,true
371+
another_app,true
372+
```
373+
374+
**Exclude specific apps:**
375+
```csv
376+
app,include
377+
splunk_monitoring_console,false
378+
learned,false
379+
introspection_generator_addon,false
380+
```
381+
382+
**How it works:**
383+
- If an app is **not listed** in app_filter.csv, it **will be monitored** (default behavior)
384+
- If an app is listed with `include=true` (or `1` or `yes`), it **will be monitored**
385+
- If an app is listed with `include=false` (or `0` or `no`), it **will NOT be monitored**
386+
- The filter applies to:
387+
- Dashboard registry updates (which dashboards are discovered)
388+
- All metrics collection (views, edits, errors, performance)
389+
- All search macros and dashboard queries
390+
391+
#### Examples
392+
393+
**Monitor only specific production apps:**
394+
```csv
395+
app,include
396+
production_app1,true
397+
production_app2,true
398+
production_app3,true
399+
```
400+
Then add a wildcard exclusion entry to exclude everything else (optional):
401+
```csv
402+
app,include
403+
production_app1,true
404+
production_app2,true
405+
*,false
406+
```
407+
408+
**Exclude system and admin apps:**
409+
```csv
410+
app,include
411+
splunk_monitoring_console,false
412+
learned,false
413+
introspection_generator_addon,false
414+
splunk_instrumentation,false
415+
```
416+
417+
**Note:** After updating `app_filter.csv`, run the "Dashboard Registry - Auto Update" search to rebuild the dashboard registry with the new filter applied.
418+
419+
### Excluding Individual Dashboards from Monitoring
343420

344-
Edit `lookups/dashboard_registry.csv` and set `status=inactive` for dashboards you want to exclude from collection.
421+
Edit `lookups/dashboard_registry.csv` and set `status=inactive` for specific dashboards you want to exclude from collection (this is independent of app filtering).
345422

346423
## Troubleshooting
347424

default/macros.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,9 @@ definition = `get_all_dashboards_summary` \
123123
| table pretty_name app views_7d errors_7d avg_load_time_7d health_status issue_type \
124124
| sort -errors_7d -avg_load_time_7d
125125
iseval = 0
126+
127+
[filter_by_app]
128+
definition = lookup app_filter app OUTPUT include \
129+
| where isnull(include) OR include="true" OR include="1" OR include="yes" \
130+
| fields - include
131+
iseval = 0

default/savedsearches.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ schedule_window = 5
101101
action.email.useNSSubject = 1
102102
alert.track = 0
103103
cron_schedule = 0 2 * * *
104-
description = Automatically updates dashboard registry via REST API
104+
description = Automatically updates dashboard registry via REST API, respecting app filter configuration
105105
dispatch.earliest_time = -5m
106106
dispatch.latest_time = now
107107
enableSched = 0
@@ -113,6 +113,9 @@ search = | rest /services/data/ui/views splunk_server=local count=0 \
113113
| eval owner=eai:acl.owner \
114114
| eval description=coalesce(eai:data, "") \
115115
| eval status="active" \
116+
| lookup app_filter app OUTPUT include \
117+
| where isnull(include) OR include="true" OR include="1" OR include="yes" \
118+
| fields - include \
116119
| table dashboard_uri pretty_name app owner description status \
117120
| outputlookup dashboard_registry.csv
118121
schedule_priority = low

default/transforms.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
[dashboard_registry]
44
filename = dashboard_registry.csv
55
case_sensitive_match = false
6+
7+
[app_filter]
8+
filename = app_filter.csv
9+
case_sensitive_match = false

lookups/APP_FILTER_README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# App Filter Configuration
2+
3+
This file controls which Splunk apps are monitored by CACA (Content Activity Checking Application).
4+
5+
## How It Works
6+
7+
- If an app is **not listed** in this file, it **WILL be monitored** (default behavior)
8+
- If an app is listed with `include=true` (or `1` or `yes`), it **WILL be monitored**
9+
- If an app is listed with `include=false` (or `0` or `no`), it **WILL NOT be monitored**
10+
11+
## Examples
12+
13+
### Include Only Specific Apps
14+
15+
To monitor ONLY certain apps, list them with include=true:
16+
17+
```csv
18+
app,include
19+
search,true
20+
my_production_app,true
21+
another_app,true
22+
```
23+
24+
### Exclude Specific Apps
25+
26+
To exclude certain apps from monitoring (monitor everything else):
27+
28+
```csv
29+
app,include
30+
splunk_monitoring_console,false
31+
learned,false
32+
introspection_generator_addon,false
33+
splunk_instrumentation,false
34+
```
35+
36+
### Mixed Configuration
37+
38+
You can combine inclusions and exclusions:
39+
40+
```csv
41+
app,include
42+
production_app1,true
43+
production_app2,true
44+
test_app,false
45+
dev_app,false
46+
```
47+
48+
## After Changing This File
49+
50+
After updating app_filter.csv:
51+
52+
1. **Rebuild the dashboard registry** by running the "Dashboard Registry - Auto Update" search manually, or wait for it to run at 2 AM
53+
2. The filter will automatically apply to all new metrics collection
54+
3. Existing metrics for excluded apps will remain in the index but won't be updated
55+
56+
## Default Behavior
57+
58+
By default (empty file), ALL apps are monitored. Add entries to this file only if you want to:
59+
- Monitor only specific apps (whitelist approach)
60+
- Exclude specific apps (blacklist approach)

lookups/app_filter.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
app,include

0 commit comments

Comments
 (0)