Skip to content

Commit b771c7d

Browse files
committed
Updates to:
`splunkversioncontrol_backup_class.py` `splunkversioncontrol_restore_class.py` To remove passwords in more cases Updates to dashboards: `splunkversioncontrol_restore.xml` `splunkversioncontrol_restore_dynamic.xml` To provide a drop down list of available knowledge objects in addition to the text field option Updated reports: `SplunkVersionControl CheckAdmin` - simplified to use the Splunk users list `splunk_vc_kom_audit_summary` - updated to ignore the manager URI's and handle proxied REST calls from the KOM report
1 parent 769bb5a commit b771c7d

File tree

7 files changed

+170
-15
lines changed

7 files changed

+170
-15
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,26 @@ To do this you will need to install Version Control For SplunkCloud on your Splu
289289
[SplunkVersionControlCloud github](https://github.com/gjanders/SplunkVersionControlCloud)
290290

291291
## Release Notes
292+
### 1.2.5
293+
Updates to:
294+
`splunkversioncontrol_backup_class.py`
295+
296+
`splunkversioncontrol_restore_class.py`
297+
298+
To remove passwords in more cases
299+
300+
Updates to dashboards:
301+
`splunkversioncontrol_restore.xml`
302+
303+
`splunkversioncontrol_restore_dynamic.xml`
304+
305+
To provide a drop down list of available knowledge objects in addition to the text field option
306+
307+
Updated reports:
308+
`SplunkVersionControl CheckAdmin` - simplified to use the Splunk users list
309+
310+
`splunk_vc_kom_audit_summary` - updated to ignore the manager URI's and handle proxied REST calls from the KOM report
311+
292312
### 1.2.4
293313
Updated `splunk_vc_kom_audit_summary` report
294314

bin/splunkversioncontrol_backup_class.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,6 @@ def run_script(self):
16161616

16171617
if stderrout.find("error:") != -1 or stderrout.find("fatal:") != -1 or stderrout.find("timeout after") != -1:
16181618
if not self.show_passwords and self.git_password:
1619-
output = output.replace(self.git_password, "password_removed")
16201619
stderrout = stderrout.replace(self.git_password, "password_removed")
16211620
logger.warn("i=\"%s\" error/fatal messages in git stderroutput please review. stderrout=\"%s\"" % (self.stanzaName, stderrout))
16221621
gitFailure = True
@@ -1705,6 +1704,8 @@ def run_script(self):
17051704
logger.error("i=\"%s\" git configuration failed for some reason output=\"%s\", stderrout=\"%s\"" % (self.stanzaName, output2, stderrout2))
17061705

17071706
if stderrout.find("error:") != -1 or stderrout.find("fatal:") != -1 or stderrout.find("timeout after") != -1:
1707+
if not self.show_passwords and self.git_password:
1708+
stderrout = stderrout.replace(self.git_password, "password_removed")
17081709
logger.warn("i=\"%s\" error/fatal messages in git stderroutput please review. stderrout=\"%s\"" % (self.stanzaName, stderrout))
17091710
gitFailure = True
17101711

@@ -1850,6 +1851,8 @@ def run_script(self):
18501851
logger.error("i=\"%s\" git configuration failed for some reason output=\"%s\", stderrout=\"%s\"" % (self.stanzaName, output2, stderrout2))
18511852

18521853
if stderrout.find("error:") != -1 or stderrout.find("fatal:") != -1 or stderrout.find("timeout after") != -1:
1854+
if not self.show_passwords and self.git_password:
1855+
stderrout = stderrout.replace(self.git_password, "password_removed")
18531856
logger.warn("i=\"%s\" error/fatal messages in git stderroutput please review. stderrout=\"%s\"" % (self.stanzaName, stderrout))
18541857
gitFailure = True
18551858

@@ -1890,6 +1893,8 @@ def run_script(self):
18901893
else:
18911894
logger.warn("i=\"%s\" unable to obtain the macro required to run the knowledge objects query" % (self.stanzaName))
18921895
if stderrout.find("error:") != -1 or stderrout.find("fatal:") != -1 or stderrout.find("timeout after") != -1:
1896+
if not self.show_passwords and self.git_password:
1897+
stderrout = stderrout.replace(self.git_password, "password_removed")
18931898
logger.warn("i=\"%s\" error/fatal messages in git stderroutput please review. stderrout=\"%s\"" % (self.stanzaName, stderrout))
18941899
gitFailure = True
18951900
else:

bin/splunkversioncontrol_restore_class.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,6 @@ def run_script(self, restlist_override=None, config_override=None):
13341334

13351335
if stderrout.find("error:") != -1 or stderrout.find("fatal:") != -1 or stderrout.find("timeout after") != -1:
13361336
if not self.show_passwords and self.git_password:
1337-
output = output.replace(self.git_password, "password_removed")
13381337
stderrout = stderrout.replace(self.git_password, "password_removed")
13391338
logger.warn("i=\"%s\" error/fatal messages in git stderroutput please review. stderrout=\"%s\"" % (self.stanzaName, stderrout))
13401339
gitFailure = True
@@ -1374,6 +1373,8 @@ def run_script(self, restlist_override=None, config_override=None):
13741373
logger.info("i=\"%s\" Successfully ran the git pull for URL=%s from directory dir=%s" % (self.stanzaName, self.gitRepoURL_logsafe, self.gitRootDir))
13751374

13761375
if stderrout.find("error:") != -1 or stderrout.find("fatal:") != -1 or stderrout.find("timeout after") != -1:
1376+
if not self.show_passwords and self.git_password:
1377+
stderrout = stderrout.replace(self.git_password, "password_removed")
13771378
logger.warn("i=\"%s\" error/fatal messages in git stderroutput please review. stderrout=\"%s\"" % (self.stanzaName, stderrout))
13781379
gitFailure = True
13791380
if stderrout.find("timeout after") != -1:
@@ -1488,7 +1489,6 @@ def run_script(self, restlist_override=None, config_override=None):
14881489

14891490
if stderrout.find("error:") != -1 or stderrout.find("fatal:") != -1 or stderrout.find("timeout after") != -1:
14901491
if not self.show_passwords and self.git_password:
1491-
output = output.replace(self.git_password, "password_removed")
14921492
stderrout = stderrout.replace(self.git_password, "password_removed")
14931493
logger.warn("i=\"%s\" error/fatal messages in git stderroutput please review. stderrout=\"%s\"" % (self.stanzaName, stderrout))
14941494
gitFailure = True

default/app.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ label = SplunkVersionControl
1212
[launcher]
1313
author = Gareth Anderson
1414
description = Version Control software for Splunk instances (backup/restore from git)
15-
version = 1.2.4
15+
version = 1.2.5
1616

1717
[package]
1818
id = SplunkVersionControl

default/data/ui/views/splunkversioncontrol_restore.xml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,73 @@
3636
<choice value="collection">collection (kvstore)</choice>
3737
<choice value="viewstate">viewstate</choice>
3838
<choice value="times">times</choice>
39+
<change>
40+
<condition value="dashboard">
41+
<set token="rest_filter">/data/ui/views</set>
42+
</condition>
43+
<condition value="savedsearch">
44+
<set token="rest_filter">/saved/searches</set>
45+
</condition>
46+
<condition value="macro">
47+
<set token="rest_filter">/configs/conf-macros</set>
48+
</condition>
49+
<condition value="fieldalias">
50+
<set token="rest_filter">/data/props/fieldaliases</set>
51+
</condition>
52+
<condition value="fieldextraction">
53+
<set token="rest_filter">/data/props/extractions</set>
54+
</condition>
55+
<condition value="fieldtransformation">
56+
<set token="rest_filter">/data/transforms/extractions</set>
57+
</condition>
58+
<condition value="navmenu">
59+
<set token="rest_filter">/data/ui/nav</set>
60+
</condition>
61+
<condition value="datamodel">
62+
<set token="rest_filter">/datamodel/model</set>
63+
</condition>
64+
<condition value="panels">
65+
<set token="rest_filter">/data/ui/panels</set>
66+
</condition>
67+
<condition value="calcfields">
68+
<set token="rest_filter">/data/props/calcfields</set>
69+
</condition>
70+
<condition value="workflowaction">
71+
<set token="rest_filter">/data/ui/workflow-actions</set>
72+
</condition>
73+
<condition value="sourcetyperenaming">
74+
<set token="rest_filter">/data/props/sourcetype-rename</set>
75+
</condition>
76+
<condition value="tags">
77+
<set token="rest_filter">/configs/conf-tags</set>
78+
</condition>
79+
<condition value="eventtypes">
80+
<set token="rest_filter">/saved/eventtypes</set>
81+
</condition>
82+
<condition value="lookupdef">
83+
<set token="rest_filter">/data/transforms/lookups</set>
84+
</condition>
85+
<condition value="automaticlookup">
86+
<set token="rest_filter">/data/props/lookups</set>
87+
</condition>
88+
<condition value="collection">
89+
<set token="rest_filter">/storage/collections/config</set>
90+
</condition>
91+
<condition value="viewstate">
92+
<set token="rest_filter">/configs/conf-viewstates</set>
93+
</condition>
94+
<condition value="times">
95+
<set token="rest_filter">/configs/conf-times</set>
96+
</condition>
97+
</change>
98+
</input>
99+
<input type="dropdown" token="name">
100+
<label>Object Name</label>
101+
<fieldForLabel>title</fieldForLabel>
102+
<fieldForValue>title</fieldForValue>
103+
<search>
104+
<query>| rest splunk_server=local /servicesNS/-/$app$/$rest_filter$ count=0 f=title f=eai:acl* | search eai:acl.app="$app$"| dedup title | fields title</query>
105+
</search>
39106
</input>
40107
<input type="text" token="name">
41108
<label>Object URI/Name (not label)</label>

default/data/ui/views/splunkversioncontrol_restore_dynamic.xml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,74 @@
3636
<choice value="collection">collection (kvstore)</choice>
3737
<choice value="viewstate">viewstate</choice>
3838
<choice value="times">times</choice>
39+
<change>
40+
<condition value="dashboard">
41+
<set token="rest_filter">/data/ui/views</set>
42+
</condition>
43+
<condition value="savedsearch">
44+
<set token="rest_filter">/saved/searches</set>
45+
</condition>
46+
<condition value="macro">
47+
<set token="rest_filter">/configs/conf-macros</set>
48+
</condition>
49+
<condition value="fieldalias">
50+
<set token="rest_filter">/data/props/fieldaliases</set>
51+
</condition>
52+
<condition value="fieldextraction">
53+
<set token="rest_filter">/data/props/extractions</set>
54+
</condition>
55+
<condition value="fieldtransformation">
56+
<set token="rest_filter">/data/transforms/extractions</set>
57+
</condition>
58+
<condition value="navmenu">
59+
<set token="rest_filter">/data/ui/nav</set>
60+
</condition>
61+
<condition value="datamodel">
62+
<set token="rest_filter">/datamodel/model</set>
63+
</condition>
64+
<condition value="panels">
65+
<set token="rest_filter">/data/ui/panels</set>
66+
</condition>
67+
<condition value="calcfields">
68+
<set token="rest_filter">/data/props/calcfields</set>
69+
</condition>
70+
<condition value="workflowaction">
71+
<set token="rest_filter">/data/ui/workflow-actions</set>
72+
</condition>
73+
<condition value="sourcetyperenaming">
74+
<set token="rest_filter">/data/props/sourcetype-rename</set>
75+
</condition>
76+
<condition value="tags">
77+
<set token="rest_filter">/configs/conf-tags</set>
78+
</condition>
79+
<condition value="eventtypes">
80+
<set token="rest_filter">/saved/eventtypes</set>
81+
</condition>
82+
<condition value="lookupdef">
83+
<set token="rest_filter">/data/transforms/lookups</set>
84+
</condition>
85+
<condition value="automaticlookup">
86+
<set token="rest_filter">/data/props/lookups</set>
87+
</condition>
88+
<condition value="collection">
89+
<set token="rest_filter">/storage/collections/config</set>
90+
</condition>
91+
<condition value="viewstate">
92+
<set token="rest_filter">/configs/conf-viewstates</set>
93+
</condition>
94+
<condition value="times">
95+
<set token="rest_filter">/configs/conf-times</set>
96+
</condition>
97+
</change>
3998
</input>
99+
<input type="dropdown" token="name">
100+
<label>Object Name</label>
101+
<fieldForLabel>title</fieldForLabel>
102+
<fieldForValue>title</fieldForValue>
103+
<search>
104+
<query>| rest splunk_server=local /servicesNS/-/$app$/$rest_filter$ count=0 f=title f=eai:acl* | search eai:acl.app="$app$"| dedup title | fields title</query>
105+
</search>
106+
</input>
40107
<input type="text" token="name">
41108
<label>Object URI/Name (not label)</label>
42109
</input>

default/savedsearches.conf

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,11 @@ display.visualizations.charting.chart = bar
8787
display.visualizations.show = 0
8888
request.ui_dispatch_app = monitoring
8989
request.ui_dispatch_view = search
90-
search = | rest /services/admin/LDAP-groups splunk_server=local \
91-
| where isnotnull(roles) \
92-
| search users IN ($ldapFilter$) roles=admin\
93-
| mvexpand users\
94-
| rex field=users "CN=(?P<username>[^,]+)"\
95-
| append [ | rest /services/authentication/users splunk_server=local \
96-
| search type=Splunk \
97-
| table title, roles \
98-
| rename title AS username \
99-
| mvexpand roles\
100-
| search roles=admin ]\
90+
search = | rest /services/authentication/users splunk_server=local \
91+
| table title, roles \
92+
| rename title AS username \
93+
| mvexpand roles \
94+
| search roles=admin \
10195
| search username IN ($usernameFilter$)\
10296
| table username
10397

@@ -176,7 +170,9 @@ display.visualizations.show = 0
176170
request.ui_dispatch_app = SplunkVersionControl
177171
request.ui_dispatch_view = search
178172
search = | savedsearch KOM_Change_Audit_Summary \
173+
| regex uri_path!="/en-[^/]+/manager/" \
179174
| eval obj_times=strftime(strptime(time_stamp,"%H:%M:%S %d-%b-%Y"),"%Y-%m-%dT%H:%M:%S%z")\
175+
| rex mode=sed field=uri_path "s/^\/en-[^\/]+\/splunkd\/__raw//g" \
180176
| stats values(ko_label) AS ko_label, values(action) AS action, values(edit_type) AS edit_type, values(origin_splunk_server) AS server, values(app_label) AS app_label, values(obj_times) AS obj_times by ko_type, user, app_name, ko_name, uri_path \
181177
| rex field=uri_path "/servicesNS/(?P<user_in_url>[^/]+)" \
182178
| eval scope=if(user_in_url=="nobody","app,global","user") \

0 commit comments

Comments
 (0)