splunk / splunk-sdk-python

Splunk Software Development Kit for Python
http://dev.splunk.com
Apache License 2.0
687 stars 369 forks source link

JSONResultsReader yields only the last message #499

Open bendikro opened 1 year ago

bendikro commented 1 year ago

This is more of a question than a bug report, as I don't know if it's actually a problem.

In JSONResultsReader, the code that handles messages looks like this:

if "messages" in parsed_line and parsed_line["messages"].__len__() > 0:
    for message in parsed_line["messages"]:
        msg_type = message.get("type", "Unknown Message Type")
        text = message.get("text")
    yield Message(msg_type, text)

Will there never be more than 1 message in messages? And if it is, it should probably be a comment to explain that. It's a bit weird to only return the last message without explaining why.

ashah-splunk commented 1 year ago

Hi @bendikro Sorry for the delay in response. Thanks for bringing this to our notice. We are looking into this and will revert back with an update soon.