From aef99a8cbae08605588e2e08efe9f0b79b268ada Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Thu, 2 Nov 2017 11:25:11 +0000 Subject: [PATCH 1/2] always log when we send out inbound sms also, downgrade client returning bad status codes from `exception` to error - it's not a problem with our system so we don't want it to trip any cloudwatch alerts or anything. --- app/celery/tasks.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index c4ac1740a..5b92db0a5 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -502,11 +502,22 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id): }, timeout=60 ) + current_app.logger.info('send_inbound_sms_to_service sending {} to {}, response {}'.format( + inbound_sms_id, + inbound_api.url, + response.status_code + )) + try: response.raise_for_status() except HTTPError as e: - current_app.logger.exception("Exception raised in send_inbound_sms_to_service for service_id: {} and url: {}. " - "\n{}".format(service_id, inbound_api.url, e)) + current_app.logger.warning( + "send_inbound_sms_to_service request failed for service_id: {} and url: {}. exc: {}".format( + service_id, + inbound_api.url, + e + ) + ) if e.response.status_code >= 500: try: self.retry(queue=QueueNames.RETRY, From 0f0110a1d190152554b6c05717faa1431b9082ba Mon Sep 17 00:00:00 2001 From: venusbb Date: Fri, 3 Nov 2017 10:41:53 +0000 Subject: [PATCH 2/2] removed printout of route secret --- app/authentication/auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/authentication/auth.py b/app/authentication/auth.py index a99d03593..0e01ec533 100644 --- a/app/authentication/auth.py +++ b/app/authentication/auth.py @@ -48,7 +48,7 @@ def restrict_ip_sms(): # Check route of inbound sms (Experimental) # Temporary custom header for route security if request.headers.get("X-Custom-forwarder"): - current_app.logger.info("X-Custom-forwarder {}".format(request.headers.get("X-Custom-forwarder"))) + current_app.logger.info("X-Custom-forwarder received") # Check IP of SMS providers if request.headers.get("X-Forwarded-For"):