From bd956886363e59ad88d013dc6063d8feabf9dc28 Mon Sep 17 00:00:00 2001 From: Kseniya Shychko Date: Wed, 10 Jan 2024 10:47:29 +0100 Subject: [PATCH] fix: keyerror when parsing user agent --- alb-s3-sqs-es/alb_s3/ingester/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alb-s3-sqs-es/alb_s3/ingester/message.py b/alb-s3-sqs-es/alb_s3/ingester/message.py index 313098c..5ceea73 100644 --- a/alb-s3-sqs-es/alb_s3/ingester/message.py +++ b/alb-s3-sqs-es/alb_s3/ingester/message.py @@ -69,7 +69,7 @@ def __init__(self, log_msg): self.message["client_port"] = client_ip[-1] # Parse User-Agent string - if self.message["user_agent"] is not None: + if "user_agent" in self.message: user_agent = parse(self.message["user_agent"]) user_agent_details = {} user_agent_details["browser"] = user_agent.get_browser()