You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
While extracting results from a saved Splunk search that leverages an appended 'inputlookup.' I get an error saying 'Message' object is not subscriptable. The issue resides in the 'Message' object being displayed first as an informational message (e.g: INFO: [subsearch]: Successfully read lookup file) from Splunklib.results, which makes the return value from splunklib.results.JSONResultsReader not subscriptable.
To Reproduce
Steps to reproduce the behavior:
Save a search in splunk as a report and make sure to use the append command or any subsearch command.
Use the splunklib.results.JSONResultsReader to parse the search results in python.
Try iterating on the report results, you will get an exception because of the 'Message' object returned from the parser.
Expected behavior
Informational messages should only be displayed when a debugging flag is active, debugging flags should be disabled by default.
Logs or Screenshots
'Message' object is not subscriptable
Informational message from parser:
INFO: [subsearch]: Successfully read lookup file '/path/of/lookup/file'.
Types of values returned from parser:
<class 'splunklib.results.Message'>
<class 'dict'>
<class 'dict'>
SDK:
Version: 1.7.4
Language Runtime Version: Python 3.7.10
OS: Ubuntu 23.04
Additional Context
If there is already something built-in the SDK to prevent these 'Message' objects, kindly let me know. Nothing in the documentation is explicitly mentioning how to disable info 'Message' objects.
The text was updated successfully, but these errors were encountered:
import results
response = ... # the body of an HTTP response
reader = results.JSONResultsReader(response)
for result in reader:
if isinstance(result, dict):
print "Result: %s" % result
elif isinstance(result, results.Message):
print "Message: %s" % result
print "is_preview = %s " % reader.is_preview
Describe the bug
While extracting results from a saved Splunk search that leverages an appended 'inputlookup.' I get an error saying 'Message' object is not subscriptable. The issue resides in the 'Message' object being displayed first as an informational message (e.g: INFO: [subsearch]: Successfully read lookup file) from Splunklib.results, which makes the return value from splunklib.results.JSONResultsReader not subscriptable.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Informational messages should only be displayed when a debugging flag is active, debugging flags should be disabled by default.
Logs or Screenshots
SDK:
Additional Context
The text was updated successfully, but these errors were encountered: