splunklib.results¶
The splunklib.results module provides a streaming XML reader for Splunk search results.
Splunk search results can be returned in a variety of formats including XML, JSON, and CSV. To make it easier to stream search results in XML format, they are returned as a stream of XML fragments, not as a single XML document. This module supports incrementally reading one result record at a time from such a result stream. This module also provides a friendly iterator-based interface for accessing search results while avoiding buffering the result set, which can be very large.
To use the reader, instantiate ResultsReader
on a search result stream
as follows::
reader = ResultsReader(result_stream)
for item in reader:
print(item)
print "Results are a preview: %s" % reader.is_preview
-
class
splunklib.results.
Message
(type_, message)¶ This class represents informational messages that Splunk interleaves in the results stream.
Message
takes two arguments: a string giving the message type (e.g., “DEBUG”), and a string giving the message itself.Example:
m = Message("DEBUG", "There's something in that variable...")
-
splunklib.results.
ResultsReader
¶ alias of
splunklib.six.deprecated.<locals>.deprecated_decorator.<locals>.deprecated_func