Skip to content

Commit d16c9d6

Browse files
author
Chris Barker
authored
PIE-67 Support user customizable indexes via macros (#12)
* prep for rebase * remove autogen readme * adds support for variable index use by sourcetype * pie_67_macros Use macros to allow custom index Before this update all the searches were configured assuming the main index was the only option. With this update, the searches will respect user set indexes for each sourcetype or a single global puppet data index. See the advanced configuration option in the Readme for more details on configuring it. This also starts the 1.5.1 release process. * remove metadata/local.meta from commit
1 parent 7770e5e commit d16c9d6

24 files changed

+255
-216
lines changed

DEVELOPING.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,38 @@ For detailed report generation, a feature for Puppet Enterprise Users, there are
2929

3030
![Report Builder](https://raw.githubusercontent.com/puppetlabs/TA-puppet-report-viewer/master/README/img/report_builder.png)
3131

32-
More information
32+
Advanced Configuration
3333
----------------
34+
All report views support using custom indexes for storing event data. They accomplish this with a series of advanced search macros. The queries assume each sourcetype can be stored in it's own index (facts, summary reports, detailed reports, bolt events, action events, Puppet Enterprise metrics).
35+
36+
There is one top level macro, `puppet_index` which defaults to "", if you configure the HEC to use a different index and want all Puppet in that index, change that value here to be `index=puppetindexname`.
37+
38+
If you are using [puppetlabs/splunk_hec](https://forge.puppet.com/puppetlabs/splunk_hec/readme) version 0.5.0 or later, you can specify different HEC tokens for Summary Reports, Facts, and Metrics. Then create an index and an associated HEC token associated with those sourcetypes, and configure both the splunk_hec module in Puppet with those new values. Actions, Bolt Events, and Detailed Reports are all submitted via different tools and would need ot be changed according to use a different HEC token. Then the corresponding macro's updated to use those indexes.
39+
40+
For example, if you want most Puppet data to go to one index, but Facts, Metrics, and Detailed Reports to go to their own indexes, one would follow these steps:
41+
- Create four indexes: puppet_data, puppet_facts_data, puppet_metrics_data, and puppet_detailed_data (or whatever name makes sense), each with their desired timespan, retention, etc.
42+
- Create four HEC's (example names):
43+
1. `puppet` with sourcetype of `puppet:summary` and the index `puppet_data`
44+
2. `puppet_facts` with sourcetype of `puppet:facts` and the index of `puppet_facts_data`
45+
3. `puppet_metrics` with sourcetype of `puppet:metrics` and the index of `puppet_metrics_data`
46+
4. `puppet_detailed` with sourcetype of `puppet:detailed` and the index of `puppet_detailed_data`
47+
- Configure the `splunk_hec` module with the corresponding tokens
48+
1. `splunk_hec::token` with the value from the `puppet` HEC (since you want all Puppet using splunk_hec plugin to go here, except for facts and metrics)
49+
2. `splunk_hec::token_facts` with the value from the `puppet_facts` HEC
50+
3. `splunk_hec::token_metrics` with the value from the `puppet_metrics` HEC
51+
- Update the Puppet Report Viewer's configuration to use the `puppet_detailed` HEC token, because detailed reports are pulled from Puppet and generated by the alert action in this application
52+
- Update the advanced search macros to use the new values:
53+
1. Open Advanced Search under the Settings -> Knowledge menu
54+
2. Select `Search Macros`
55+
3. Select `puppet_index` and change the definition to `index=puppet_data`, click save
56+
4. Select `puppet_facts_index` and change the definition to `index=puppet_facts_data`, click save
57+
5. Select `puppet_metrics_index` and change the definition to `index=puppet_metrics_data`, click save
58+
6. Select `puppet_detailed_index` and change the definition to `index=puppet_detailed_data`, click save
59+
- Reload the main view of the Puppet Report Viewer app, and you should see data, or perform the following search:
60+
```
61+
`puppet_all_index` sourcetype=puppet:*
62+
```
63+
3464

3565
More information
3666
----------------

README.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

README/DEVELOPING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ In order to load this module properly into the Splunk Add-On builder for develop
1010

1111
```
1212
$ git checkout -b 'my working branch'
13-
$ tar -C .. --exclude=".git" --exclude="tmpdir" -czvf tmpdir/TA-puppet-report-viewer.tar.gz TA-puppet-report-viewer
13+
$ COPYFILE_DISABLE=1 tar -C .. --exclude=".git" --exclude="local/" --exclude="metadata/local.meta" --exclude="tmpdir" -czvf tmpdir/TA-puppet-report-viewer.tar.gz TA-puppet-report-viewer
1414
```
1515

1616
To add your finished work back to the repo:
@@ -22,7 +22,7 @@ To add your finished work back to the repo:
2222

2323
```
2424
$ cd tmpdir
25-
$ tar xzvf TA-puppet-tasks-actionable_2_0_1_export.tgz
25+
$ tar xzvf TA-puppet-report-viewer_2_0_1_export.tgz
2626
$ cd ..
27-
$ rsync -vr tmpdir/TA-puppet-tasks-actionable_2_0_1_export/* ./
27+
$ rsync -vr tmpdir/TA-puppet-report-viewer_2_0_1_export/* ./
2828
```

README/publishing.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Puppet Report Viewer Publishing Guide
2+
==============
3+
4+
This documents how this plugin is published.
5+
6+
- Finalize testing
7+
- Bundle this app up using the export options in the developing.md guide
8+
- Import tar.gz into Splunk AddOn Builder for final validation preflight check
9+
- Complete and fix validation steps if needed
10+
- Make needed changes, tag build with final release number and publish a release in GitHub adding notes from releasenotes.md
11+
- Rename file name to be .spl instead of .tar.gz
12+
- Import .spl version to Splunk to verify that package installs properly
13+
- Upload .spl to Splunkbase

README/releasenotes.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Release Notes
2+
==============
3+
4+
1.5.1:
5+
New Features:
6+
- Full dashboard updates
7+
- Support for Facts sourcetype (puppet:facts), and dashboards to use it
8+
- Introduces "Report Builder" page to help a user build reports and then craft custom search from the iterface to use for alerts or their own uses
9+
- Introduces Advanced Search macros to allow for customized indexs without requiring to modify the app. See Advanced Configuration section of the readme
10+
- Add's sourcetypes of puppet:action, puppet:metrics, for future use
11+
- Example Alert added, the search to generate a detailed report for any summary report that isn't "unchanged" has been added to the app, but set as disabled
12+
13+
Fixes:
14+
- Duplicate item entry fixed, sourcetype's are now configured to extract KV from json only once
15+
- [Updated documentation](https://github.com/puppetlabs/ta-puppet-report-viewer)
16+

TA-puppet-report-viewer.aob_meta

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

app.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"id": {
66
"group": null,
77
"name": "TA-puppet-report-viewer",
8-
"version": "1.4.0"
8+
"version": "1.5.1"
99
},
1010
"author": [
1111
{

default/app.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build = 3
77

88
[launcher]
99
author = Puppet, Inc.
10-
version = 1.4.0
10+
version = 1.5.1
1111

1212
[ui]
1313
is_visible = 1

default/data/ui/views/all_reports.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<fieldForLabel>os.family</fieldForLabel>
1414
<fieldForValue>os.family</fieldForValue>
1515
<search>
16-
<query>sourcetype="puppet:facts"
16+
<query>`puppet_facts_index` sourcetype="puppet:facts"
1717
| top os.family limit=100</query>
1818
<earliest>$reportTimeRange.earliest$</earliest>
1919
<latest>$reportTimeRange.latest$</latest>
@@ -24,7 +24,7 @@
2424
<fieldForLabel>environment</fieldForLabel>
2525
<fieldForValue>environment</fieldForValue>
2626
<search>
27-
<query>sourcetype="puppet:facts"
27+
<query>`puppet_facts_index` sourcetype="puppet:facts"
2828
| top environment limit=100</query>
2929
<earliest>$reportTimeRange.earliest$</earliest>
3030
<latest>$reportTimeRange.latest$</latest>
@@ -35,7 +35,7 @@
3535
<fieldForLabel>networking.domain</fieldForLabel>
3636
<fieldForValue>networking.domain</fieldForValue>
3737
<search>
38-
<query>sourcetype="puppet:facts"
38+
<query>`puppet_facts_index` sourcetype="puppet:facts"
3939
| top networking.domain limit=100</query>
4040
<earliest>$reportTimeRange.earliest$</earliest>
4141
<latest>$reportTimeRange.latest$</latest>
@@ -46,7 +46,7 @@
4646
<panel>
4747
<table>
4848
<search>
49-
<query>sourcetype="puppet:summary"
49+
<query>`puppet_summary_index` sourcetype="puppet:summary"
5050
| eval "certname"=mvdedup('certname'),"run_time"=mvdedup('metrics.time.total')
5151
| eval strf_time=strftime(_time, "%Y-%m-%d %T %:z")
5252
| eval run_time_rnd=round(run_time,1)

0 commit comments

Comments
 (0)