From f9ace847e6c8863657a530a93ea3c325a0f1d9ea Mon Sep 17 00:00:00 2001 From: Matthew O'Brien Date: Tue, 15 Oct 2024 16:52:50 -0400 Subject: [PATCH] Remove extra json.dumps The ingest function contains an unnecessary json.dump which results in strings of JSON being ingested by Chronicle rather than JSON logs which can be parsed. --- pubsub/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pubsub/main.py b/pubsub/main.py index 8ea753c..451b6b3 100644 --- a/pubsub/main.py +++ b/pubsub/main.py @@ -51,11 +51,9 @@ def build_and_ingest_payload(log: Union[Dict[Any, Any], List[Any]]) -> str: if PAYLOAD_SIZE == 0: # Build a new object. PAYLOAD = [] - log = json.dumps(log) PAYLOAD.append(log) PAYLOAD_SIZE = PAYLOAD_SIZE + (sys.getsizeof(json.dumps(PAYLOAD))) else: - log = json.dumps(log) logsize = sys.getsizeof(log) # Send when the payload hits a certain size. if PAYLOAD_SIZE + logsize > PAYLOAD_THRESHOLD: