Skip to content

Commit bf335b9

Browse files
authored
1.4.0 (#7)
* add facet, improve logging * version * Add facet and update examples * add facet * version * update readme
1 parent 6ae1f29 commit bf335b9

File tree

8 files changed

+214
-101
lines changed

8 files changed

+214
-101
lines changed

README.md

Lines changed: 66 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Reference Splunk documentation for [installing add-ons](https://docs.splunk.com/
2929

3030
![Creating DataSet API keys](README_images/dataset_key.png)
3131

32-
2. Click Add Key > Add Read Key (required for inputs and search command).
32+
2. Click Add Key > Add Read Key (required for search command and inputs).
3333
3. Click Add Key > Add Write Key (required for alert action).
3434
4. Optionally, click the pencil icon to rename the keys.
3535

@@ -40,65 +40,31 @@ Reference Splunk documentation for [installing add-ons](https://docs.splunk.com/
4040

4141
2. In configuration on DataSet Account tab:
4242
- Enter the DataSet URL (e.g.: `https://app.scalyr.com`).
43-
- Enter the DataSet read key.
44-
- Enter the DataSet write key.
43+
- Enter the DataSet read key from above.
44+
- Enter the DataSet write key from above.
4545

4646
3. Optionally, configure logging level and proxy information on the associated tabs.
4747
4. Click Save.
48-
49-
5. On the inputs page, click Create New Input and select the desired input
50-
51-
6. For DataSet alerts, enter:
52-
53-
![Setup alerts indexing](README_images/setup_alerts.png)
54-
- A name for the input.
55-
- Interval, in seconds. A good starting point is `300` seconds to collect every five mintues.
56-
- Splunk index name
57-
- Start time, in relative shorthand form, e.g.: `24h` for 24 hours before input execution time.
58-
59-
7. For DataSet queries, enter:
60-
61-
![Setup query indexing](README_images/setup_query.png)
62-
- A name for the input.
63-
- Interval, in seconds. A good starting point is `300` seconds to collect every five mintues.
64-
- Splunk index name
65-
- Start time, in relative shorthand form, e.g.: `24h` for 24 hours before input execution time.
66-
- *(optional)* End time, in relative shorthand form, e.g.: `5m` for 5 minutes before input execution time.
67-
- *(optional)* Query string used to return matching events.
68-
- *(optional)* Maximum number of events to return.
69-
70-
8. For DataSet Power Queries, enter:
71-
- A name for the input.
72-
- Interval, in seconds. A good starting point is `300` seconds to collect every five mintues.
73-
- Splunk index name
74-
- Start time, in relative shorthand form, e.g.: `24h` for 24 hours before input execution time.
75-
- *(optional)* End time, in relative shorthand form, e.g.: `5m` for 5 minutes before input execution time.
76-
- Query string used to return matching events, including commands such as `| columns`, `| limit`, etc.
77-
78-
## Usage
79-
80-
### Inputs
81-
The DataSet Add-on for Splunk collects the following inputs utilizing time-based checkpointing to prevent reindexing the same data:
82-
83-
| Source Type | Description | CIM Data Model |
84-
| ------ | ------ | ------ |
85-
| dataset:alerts | Predefined Power Query API call to index [alert state change records](https://app.scalyr.com/help/alerts#logging) | [Alerts](https://docs.splunk.com/Documentation/CIM/latest/User/Alerts) |
86-
| dataset:query | User-defined standard [query](https://app.scalyr.com/help/api#query) API call to index events | - |
87-
| dataset:powerquery | User-defined [PowerQuery](https://app.scalyr.com/help/api#powerquery) API call to index events | - |
48+
5. To confirm connectivity, simply search `|dataset` and validate results.
8849

8950
## SPL Command
90-
The `| dataset` command allows queries against the DataSet API directly from Splunk's search bar. Optional parameters are supported:
51+
The `| dataset` command allows queries against the DataSet API directly from Splunk's search bar.
9152

92-
- **method** - Define `query`, `powerquery` or `timeseries` to call the appropriate REST endpoint. Default is query.
93-
- **query** - The DataSet [query](https://app.scalyr.com/help/query-language) or filter used to select events. Default is no filter (return all events limited by maxCount).
53+
Optional parameters are supported:
54+
55+
- **method** - Define `query`, `powerquery`, `facet` or `timeseries` to call the appropriate REST endpoint. Default is query.
56+
- **query** - The DataSet [query](https://app.scalyr.com/help/query-language) or filter used to select events. Default is no filter (return all events limited by time and maxCount).
9457
- **starttime** - The Splunk time picker can be used (not "All Time"), but if starttime is defined it will take precedence to define the [start time](https://app.scalyr.com/help/time-reference) for DataSet events to return. Use epoch time or relative shorthand in the form of a number followed by d, h, m or s (for days, hours, minutes or seconds), e.g.: `24h`. Default is 24h.
9558
- **endtime** - The Splunk time picker can be used (not "All Time"), but if endtime is defined it will take precedence to define the [end time](https://app.scalyr.com/help/time-reference) for DataSet events to return. Use epoch time or relative shorthand in the form of a number followed by d, h, m or s (for days, hours, minutes or seconds), e.g.: `5m`. Default is current time at search.
9659

97-
For query and powerquery, additional parameters include:
60+
For query and powerquery:
9861
- **maxcount** - Number of events to return.
9962
- **columns** - Specified fields to return from DataSet query (or powerquery, analogous to using `| columns` in a powerquery). Yields performance gains for high volume queries instead of returning and merging all fields.
10063

101-
For timeseries, additional parameters include:
64+
For facet:
65+
- **field** - Define field to get most frequent values of. Default is logfile.
66+
67+
For timeseries:
10268
- **function** - Define value to compute from matching events. Default is rate.
10369
- **buckets** - The number of numeric values to return by dividing time range into equal slices. Default is 1.
10470
- **createsummaries** - Specify whether to create summaries to automatically update on ingestion pipeline. Default is true; recommend setting to false for one-off or while testing new queries.
@@ -123,24 +89,71 @@ Power Query Example 2: `| dataset method=powerQuery search="$serverHost == 'clou
12389
| sort -DUR
12490
| columns 'Request ID' = RID, 'Duration(ms)' = DUR, 'Charged delta (ms)' = deltaDUR, 'Used Memory (MB)' = UMEM, 'Charged delta Memory (MB)' = deltaMEM" starttime=5m`
12591

126-
Since events are returned in JSON format, the Splunk [spath command](https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Spath) is useful. Additionally, the Splunk [collect command](https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/collect) can be used to add the events to a summary index:
127-
92+
Facet Query Example:
12893
`
129-
| dataset query="serverHost = * AND Action = 'allow'" maxcount=50 starttime=10m endtime=1m
94+
| dataset method=facet search="serverHost = *" field=serverHost maxcount=25
13095
| spath
131-
| collect index=dataset
96+
| table value, count
13297
`
13398

13499
Timeseries Query Example:
135100
`
136101
| dataset method=timeseries search="serverHost='scalyr-metalog'" function="p90(delayMedian)" starttime="24h" buckets=24 createsummaries=false onlyusesummaries=false
137102
`
138103

104+
Since events are returned in JSON format, the Splunk [spath command](https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Spath) is useful. Additionally, the Splunk [collect command](https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/collect) can be used to add the events to a summary index:
105+
106+
`
107+
| dataset query="serverHost = * AND Action = 'allow'" maxcount=50 starttime=10m endtime=1m
108+
| spath
109+
| collect index=dataset
110+
`
111+
112+
## Inputs
113+
For use cases requiring data indexed in Splunk, optional inputs are provided utilizing time-based checkpointing to prevent reindexing the same data:
114+
115+
| Source Type | Description | CIM Data Model |
116+
| ------ | ------ | ------ |
117+
| dataset:alerts | Predefined Power Query API call to index [alert state change records](https://app.scalyr.com/help/alerts#logging) | [Alerts](https://docs.splunk.com/Documentation/CIM/latest/User/Alerts) |
118+
| dataset:query | User-defined standard [query](https://app.scalyr.com/help/api#query) API call to index events | - |
119+
| dataset:powerquery | User-defined [PowerQuery](https://app.scalyr.com/help/api#powerquery) API call to index events | - |
120+
121+
1. On the inputs page, click Create New Input and select the desired input
122+
123+
2. For DataSet alerts, enter:
124+
125+
![Setup alerts indexing](README_images/setup_alerts.png)
126+
- A name for the input.
127+
- Interval, in seconds. A good starting point is `300` seconds to collect every five mintues.
128+
- Splunk index name
129+
- Start time, in relative shorthand form, e.g.: `24h` for 24 hours before input execution time.
130+
131+
3. For DataSet queries, enter:
132+
133+
![Setup query indexing](README_images/setup_query.png)
134+
- A name for the input.
135+
- Interval, in seconds. A good starting point is `300` seconds to collect every five mintues.
136+
- Splunk index name
137+
- Start time, in relative shorthand form, e.g.: `24h` for 24 hours before input execution time.
138+
- *(optional)* End time, in relative shorthand form, e.g.: `5m` for 5 minutes before input execution time.
139+
- *(optional)* Query string used to return matching events.
140+
- *(optional)* Maximum number of events to return.
141+
142+
4. For DataSet Power Queries, enter:
143+
- A name for the input.
144+
- Interval, in seconds. A good starting point is `300` seconds to collect every five mintues.
145+
- Splunk index name
146+
- Start time, in relative shorthand form, e.g.: `24h` for 24 hours before input execution time.
147+
- *(optional)* End time, in relative shorthand form, e.g.: `5m` for 5 minutes before input execution time.
148+
- Query string used to return matching events, including commands such as `| columns`, `| limit`, etc.
149+
139150
## Alert Action
140151
An alert action allows sending an event to the DataSet [addEvents API](https://app.scalyr.com/help/api#addEvents).
141152

142153
## Support
143-
For support, please open an issue on GitHub.
154+
To troubleshooting the custom command, check the Job Inspector search log, also available in the internal index: `index=_internal app="TA-dataset" sourcetype=splunk_search_messages`. Common issues include incorrect API key or firewalls blocking outbound traffic on port 443.
155+
156+
For support, open a ticket with support, or open a GitHub issue.
144157

145158
##### Note
146159
This add-on was built with the [Splunk Add-on UCC framework](https://splunk.github.io/addonfactory-ucc-generator/).

globalConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"meta": {
33
"name": "TA-dataset",
44
"displayName": "DataSet Add-on for Splunk",
5-
"version": "1.3.0",
5+
"version": "1.4.0",
66
"restRoot": "TA_dataset",
77
"schemaVersion": "0.0.3"
88
},

output/TA-dataset-1.3.0.tar.gz

-2.95 MB
Binary file not shown.

output/TA-dataset-1.4.0.tar.gz

2.95 MB
Binary file not shown.

package/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-dataset",
8-
"version": "1.3.0"
8+
"version": "1.4.0"
99
},
1010
"author": [
1111
{

0 commit comments

Comments
 (0)