Skip to content

Commit d664031

Browse files
author
David Noble
committed
Release 1.2.3
2 parents 7a5f896 + 467c11c commit d664031

27 files changed

+913
-176
lines changed

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
# Splunk SDK for Python Changelog
22

3+
4+
## Version 1.2.3
5+
6+
### New features and APIs
7+
8+
* Improved error handling in custom search commands
9+
10+
SearchCommand.process now catches all exceptions and
11+
12+
1. Writes an error message for display in the Splunk UI.
13+
14+
The error message is the text of the exception. This is new behavior.
15+
16+
2. Logs a traceback to SearchCommand.logger. This is old behavior.
17+
18+
* Made ResponseReader more streamlike, so that it can be wrapped in an
19+
io.BufferedReader to realize a significant performance gain.
20+
21+
*Example usage*
22+
23+
```
24+
import io
25+
...
26+
response = job.results(count=maxRecords, offset=self._offset)
27+
resultsList = results.ResultsReader(io.BufferedReader(response))
28+
```
29+
30+
### Bug fixes
31+
32+
1. The results reader now catches SyntaxError exceptions instead of
33+
`xml.etree.ElementTree.ParseError` exceptions. `ParseError` wasn't
34+
introduced until Python 2.7. This masked the root cause of errors
35+
data errors in result elements.
36+
37+
2. When writing a ReportingCommand you no longer need to include a map method.
38+
339
## Version 1.2.2
440

541
### Bug fixes

Commands.conf.spec.xlsx

15 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The Splunk Software Development Kit for Python
22

3-
#### Version 1.2.2
3+
#### Version 1.2.3
44

55
The Splunk Software Development Kit (SDK) for Python contains library code and
66
examples designed to enable developers to build applications using Splunk.

examples/searchcommands_app/bin/population.csv

Lines changed: 629 additions & 0 deletions
Large diffs are not rendered by default.

examples/searchcommands_app/default/logging.conf

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#
2+
# The format of this file is described in this article at Python.org:
3+
#
4+
# [Configuration file format](http://goo.gl/K6edZ8)
5+
#
16
[loggers]
27
keys = root, CountMatchesCommand, SimulateCommand, SumCommand
38

@@ -8,25 +13,34 @@ handlers = stderr ; Default: stderr
813
[logger_CountMatchesCommand]
914
qualname = CountMatchesCommand
1015
level = NOTSET ; Default: WARNING
11-
handlers = stderr ; Default: stderr
16+
handlers = file ; Default: stderr
1217
propagate = 0 ; Default: 1
1318

1419
[logger_SimulateCommand]
1520
qualname = SimulateCommand
1621
level = NOTSET ; Default: WARNING
17-
handlers = stderr ; Default: stderr
22+
handlers = file ; Default: stderr
1823
propagate = 0 ; Default: 1
1924

2025
[logger_SumCommand]
2126
qualname = SumCommand
2227
level = NOTSET ; Default: WARNING
23-
handlers = stderr ; Default: stderr
28+
handlers = file ; Default: stderr
2429
propagate = 0 ; Default: 1
2530

2631
[handlers]
27-
keys=stderr
32+
# See [logging.handlers](http://goo.gl/9aoOx)
33+
keys=file, stderr
34+
35+
[handler_file]
36+
# Select this handler to log events to $SPLUNK_HOME/etc/apps/searchcommands_app/searchcommands_app.log
37+
class = logging.FileHandler
38+
level = NOTSET
39+
args = ('searchcommand_app.log', 'a', 'utf-8', True)
40+
formatter = search_command
2841

2942
[handler_stderr]
43+
# Select this handler to log events to $SPLUNK_HOME/var/log/splunk/splunkd.log
3044
class = logging.StreamHandler
3145
level = NOTSET
3246
args = (sys.stderr,)

examples/searchcommands_template/bin/generate.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
#!/usr/bin/env python
2-
#
3-
# Copyright 2011-2014 Splunk, Inc.
4-
#
5-
# Licensed under the Apache License, Version 2.0 (the "License"): you may
6-
# not use this file except in compliance with the License. You may obtain
7-
# a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14-
# License for the specific language governing permissions and limitations
15-
# under the License.
162

173
import sys
184
from splunklib.searchcommands import \

examples/searchcommands_template/bin/report.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
#!/usr/bin/env python
2-
#
3-
# Copyright 2011-2014 Splunk, Inc.
4-
#
5-
# Licensed under the Apache License, Version 2.0 (the "License"): you may
6-
# not use this file except in compliance with the License. You may obtain
7-
# a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14-
# License for the specific language governing permissions and limitations
15-
# under the License.
162

173
import sys
184
from splunklib.searchcommands import \

examples/searchcommands_template/bin/stream.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
#!/usr/bin/env python
2-
#
3-
# Copyright 2011-2014 Splunk, Inc.
4-
#
5-
# Licensed under the Apache License, Version 2.0 (the "License"): you may
6-
# not use this file except in compliance with the License. You may obtain
7-
# a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14-
# License for the specific language governing permissions and limitations
15-
# under the License.
162

173
import sys
184
from splunklib.searchcommands import \

examples/searchcommands_template/default/data/ui/nav/default.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- TODO: Templatize this content -->
21
<nav>
32
<view name="flashtimeline" default='true' />
43
<collection label="Dashboards">

examples/searchcommands_template/default/logging.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#
2+
# The format of this file is described in this article at Python.org:
3+
#
4+
# [Configuration file format](http://goo.gl/K6edZ8)
5+
#
16
[loggers]
27
keys = root, %(command.title())Command
38

0 commit comments

Comments
 (0)