splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

JSONResultsReader yields only the last message

Open bendikro opened this issue 4 years ago • 2 comments

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.

bendikro avatar Nov 22 '22 18:11 bendikro

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.

ashah-splunk avatar Jan 05 '23 12:01 ashah-splunk

Dismissed as stale.

Ickerday avatar Sep 08 '25 17:09 Ickerday