5
5
6
6
#### Version 1.6.12
7
7
8
- The Splunk Software Development Kit (SDK) for Python contains library code and
8
+ The Splunk Software Development Kit (SDK) for Python contains library code and
9
9
examples designed to enable developers to build applications using Splunk.
10
10
11
11
Splunk is a search engine and analytic environment that uses a distributed
12
- map-reduce architecture to efficiently index, search and process large
12
+ map-reduce architecture to efficiently index, search and process large
13
13
time-varying data sets.
14
14
15
15
The Splunk product is popular with system administrators for aggregation and
@@ -25,31 +25,31 @@ are enabled by Splunk's unique capabilities.
25
25
## Getting started with the Splunk SDK for Python
26
26
27
27
The Splunk SDK for Python contains library code and examples that show how to
28
- programmatically interact with Splunk for a variety of scenarios including
29
- searching, saved searches, data inputs, and many more, along with building
30
- complete applications.
28
+ programmatically interact with Splunk for a variety of scenarios including
29
+ searching, saved searches, data inputs, and many more, along with building
30
+ complete applications.
31
31
32
32
The information in this Readme provides steps to get going quickly, but for more
33
- in-depth information be sure to visit the
34
- [ Splunk Developer Portal] ( http://dev.splunk.com/view/SP-CAAAEBB ) .
33
+ in-depth information be sure to visit the
34
+ [ Splunk Developer Portal] ( http://dev.splunk.com/view/SP-CAAAEBB ) .
35
35
### Requirements
36
36
37
37
Here's what you need to get going with the Splunk SDK for Python.
38
38
39
39
#### Python
40
40
41
- The Splunk SDK for Python requires Python 2.7+, including Python 3. The Splunk SDK for Python has been tested with Python v2.7 and v3.5.
41
+ The Splunk SDK for Python requires Python 2.7+, including Python 3. The Splunk SDK for Python has been tested with Python v2.7 and v3.5.
42
42
43
43
#### Splunk
44
44
45
- If you haven't already installed Splunk, download it
46
- [ here] ( http://www.splunk.com/download ) . For more about installing and running
47
- Splunk and system requirements, see
45
+ If you haven't already installed Splunk, download it
46
+ [ here] ( http://www.splunk.com/download ) . For more about installing and running
47
+ Splunk and system requirements, see
48
48
[ Installing & Running Splunk] ( http://dev.splunk.com/view/SP-CAAADRV ) . The Splunk SDK for Python has been tested with Splunk Enterprise 7.0 and 7.2.
49
49
50
50
#### Splunk SDK for Python
51
- Get the Splunk SDK for Python; [ download the SDK as a ZIP] ( http://dev.splunk.com/view/SP-CAAAEBB )
52
- and extract the files. Or, if you want to contribute to the SDK, clone the
51
+ Get the Splunk SDK for Python; [ download the SDK as a ZIP] ( http://dev.splunk.com/view/SP-CAAAEBB )
52
+ and extract the files. Or, if you want to contribute to the SDK, clone the
53
53
repository from [ GitHub] ( https://github.com/splunk/splunk-sdk-python ) .
54
54
55
55
@@ -85,17 +85,17 @@ home folder and are running OS X or Linux, add the following line to your
85
85
export PYTHONPATH=~/splunk-sdk-python
86
86
87
87
The SDK command-line examples require a common set of arguments
88
- that specify things like the Splunk host, port, and login credentials. For a
89
- full list of command-line arguments, include ` --help ` as an argument to any of
90
- the examples.
88
+ that specify things like the Splunk host, port, and login credentials. For a
89
+ full list of command-line arguments, include ` --help ` as an argument to any of
90
+ the examples.
91
91
92
92
#### .splunkrc
93
93
94
94
To connect to Splunk, many of the SDK examples and unit tests take command-line
95
95
arguments that specify values for the host, port, and login credentials for
96
96
Splunk. For convenience during development, you can store these arguments as
97
- key-value pairs in a text file named ** .splunkrc** . Then, the SDK examples and
98
- unit tests use the values from the ** .splunkrc** file when you don't specify
97
+ key-value pairs in a text file named ** .splunkrc** . Then, the SDK examples and
98
+ unit tests use the values from the ** .splunkrc** file when you don't specify
99
99
them.
100
100
101
101
To use this convenience file, create a text file with the following format:
@@ -115,39 +115,39 @@ To use this convenience file, create a text file with the following format:
115
115
116
116
Save the file as ** .splunkrc** in the current user's home directory.
117
117
118
- * For example on OS X, save the file as:
118
+ * For example on OS X, save the file as:
119
119
120
120
~/.splunkrc
121
121
122
- * On Windows, save the file as:
122
+ * On Windows, save the file as:
123
123
124
124
C:\Users\currentusername\.splunkrc
125
125
126
126
You might get errors in Windows when you try to name the file because
127
127
".splunkrc" looks like a nameless file with an extension. You can use
128
- the command line to create this file&mdash ; go to the
129
- ** C:\Users\currentusername** directory and enter the following command:
128
+ the command line to create this file&mdash ; go to the
129
+ ** C:\Users\currentusername** directory and enter the following command:
130
130
131
131
Notepad.exe .splunkrc
132
132
133
133
Click ** Yes** , then continue creating the file.
134
134
135
- ** Note** : Storing login credentials in the ** .splunkrc** file is only for
136
- convenience during development. This file isn't part of the Splunk platform and
137
- shouldn't be used for storing user credentials for production. And, if you're
138
- at all concerned about the security of your credentials, just enter them at
139
- the command line rather than saving them in this file.
135
+ ** Note** : Storing login credentials in the ** .splunkrc** file is only for
136
+ convenience during development. This file isn't part of the Splunk platform and
137
+ shouldn't be used for storing user credentials for production. And, if you're
138
+ at all concerned about the security of your credentials, just enter them at
139
+ the command line rather than saving them in this file.
140
140
141
141
142
142
#### Examples
143
143
144
- Examples are located in the ** /splunk-sdk-python/examples** directory. To run
145
- the examples at the command line, use the Python interpreter and include any
144
+ Examples are located in the ** /splunk-sdk-python/examples** directory. To run
145
+ the examples at the command line, use the Python interpreter and include any
146
146
arguments that are required by the example:
147
147
148
148
python examplename.py --username="admin" --password="changeme"
149
149
150
- If you saved your login credentials in the ** .splunkrc** file, you can omit
150
+ If you saved your login credentials in the ** .splunkrc** file, you can omit
151
151
those arguments:
152
152
153
153
python examplename.py
@@ -158,23 +158,36 @@ To get help for an example, use the `--help` argument with an example:
158
158
159
159
#### Unit tests
160
160
161
- The Splunk SDK for Python contains a collection of unit tests. To run them, open a
161
+ The Splunk SDK for Python contains a collection of unit tests. To run them, open a
162
162
command prompt in the ** /splunk-sdk-python** directory and enter:
163
163
164
- python setup.py test
164
+ make
165
165
166
- You can also run individual test files, which are located in
167
- ** /splunk-sdk-python/tests** . For example, to run the apps test, open a command
168
- prompt in the ** /splunk-sdk-python/tests ** subdirectory and enter :
166
+ You can also run individual test files, which are located in
167
+ ** /splunk-sdk-python/tests** . The following command explains how to run
168
+ a specific test :
169
169
170
- python test_app.py
170
+ make test_specific
171
171
172
- The test suite uses Python's standard library and the built-in ` unittest `
173
- library.
172
+ The test suite uses Python's standard library, the built-in ` unittest `
173
+ library, ` pytest ` , and ` tox ` .
174
+
175
+ ** Important Notes:**
176
+
177
+ The test run will fail unless the
178
+ [ SDK App Collection] ( https://github.com/splunk/sdk-app-collection ) is installed.
179
+
180
+ You can exclude app-specific tests with the following command:
181
+
182
+ make test_no_app
174
183
175
184
You can read more about our testing framework on
176
185
[ GitHub] ( https://github.com/splunk/splunk-sdk-python/tree/master/tests ) .
177
186
187
+ In addition, the test run requires the searchcommands app to be built. The ` make `
188
+ command runs the tasks to do this, but more complex testing may require you to
189
+ rebuild using ` make build_app ` .
190
+
178
191
## Repository
179
192
180
193
<table >
@@ -209,34 +222,34 @@ You can read more about our testing framework on
209
222
### Changelog
210
223
211
224
The ** CHANGELOG.md** file in the root of the repository contains a description
212
- of changes for each version of the SDK. You can also find it online at
225
+ of changes for each version of the SDK. You can also find it online at
213
226
[ https://github.com/splunk/splunk-sdk-python/blob/master/CHANGELOG.md ] ( https://github.com/splunk/splunk-sdk-python/blob/master/CHANGELOG.md ) .
214
227
215
228
### Branches
216
229
217
230
The ** master** branch always represents a stable and released version of the SDK.
218
- You can read more about our branching model on our Wiki at
231
+ You can read more about our branching model on our Wiki at
219
232
[ https://github.com/splunk/splunk-sdk-python/wiki/Branching-Model ] ( https://github.com/splunk/splunk-sdk-python/wiki/Branching-Model ) .
220
233
221
234
## Documentation and resources
222
- If you need to know more:
235
+ If you need to know more:
223
236
224
- * For all things developer with Splunk, your main resource is the
237
+ * For all things developer with Splunk, your main resource is the
225
238
[ Splunk Developer Portal] ( http://dev.splunk.com ) .
226
239
227
- * For conceptual and how-to documentation, see the
240
+ * For conceptual and how-to documentation, see the
228
241
[ Overview of the Splunk SDK for Python] ( http://dev.splunk.com/view/SP-CAAAEBB ) .
229
242
230
- * For API reference documentation, see the
243
+ * For API reference documentation, see the
231
244
[ Splunk SDK for Python Reference] ( http://docs.splunk.com/Documentation/PythonSDK ) .
232
245
233
- * For more about the Splunk REST API, see the
246
+ * For more about the Splunk REST API, see the
234
247
[ REST API Reference] ( http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI ) .
235
248
236
- * For more about about Splunk in general, see
249
+ * For more about about Splunk in general, see
237
250
[ Splunk>Docs] ( http://docs.splunk.com/Documentation/Splunk ) .
238
251
239
- * For more about this SDK's repository, see our
252
+ * For more about this SDK's repository, see our
240
253
[ GitHub Wiki] ( https://github.com/splunk/splunk-sdk-python/wiki/ ) .
241
254
242
255
## Community
@@ -284,24 +297,24 @@ If you would like to contribute to the SDK, go here for more information:
284
297
285
298
### Support
286
299
287
- 1 . You will be granted support if you or your company are already covered
288
- under an existing maintenance/support agreement.
289
- Submit a new case in the [ Support Portal] [ contact ] and include "Splunk SDK for Python"
290
- in the subject line.
291
- 2 . If you are not covered under an existing maintenance/support agreement, you
292
- can find help through the broader community at:
293
- <ul >
294
- <li ><a href =' http://splunk-base.splunk.com/answers/ ' >Splunk Answers</a > (use
295
- the <b >sdk</b >, <b >java</b >, <b >python</b >, and <b >javascript</b > tags to
296
- identify your questions)</li >
297
- </ul >
298
- 3 . Splunk will NOT provide support for SDKs if the core library (the
299
- code in the <b >/splunklib</b > directory) has been modified. If you modify an
300
- SDK and want support, you can find help through the broader community and
301
- Splunk answers (see above). We would also like to know why you modified the
302
- core library
&mdash ; please send feedback to
[email protected] .
300
+ 1 . You will be granted support if you or your company are already covered
301
+ under an existing maintenance/support agreement.
302
+ Submit a new case in the [ Support Portal] [ contact ] and include "Splunk SDK for Python"
303
+ in the subject line.
304
+ 2 . If you are not covered under an existing maintenance/support agreement, you
305
+ can find help through the broader community at:
306
+ <ul >
307
+ <li ><a href =' http://splunk-base.splunk.com/answers/ ' >Splunk Answers</a > (use
308
+ the <b >sdk</b >, <b >java</b >, <b >python</b >, and <b >javascript</b > tags to
309
+ identify your questions)</li >
310
+ </ul >
311
+ 3 . Splunk will NOT provide support for SDKs if the core library (the
312
+ code in the <b >/splunklib</b > directory) has been modified. If you modify an
313
+ SDK and want support, you can find help through the broader community and
314
+ Splunk answers (see above). We would also like to know why you modified the
315
+ core library
&mdash ; please send feedback to
[email protected] .
303
316
4 . File any issues on [ GitHub] ( https://github.com/splunk/splunk-sdk-python/issues ) .
304
-
317
+
305
318
### Contact Us
306
319
307
320
You can [ contact support] [ contact ] if you have Splunk related questions.
0 commit comments