diff --git a/localstack/aws/handlers/logging.py b/localstack/aws/handlers/logging.py index 96a756b4fb828..57ec71046dc0c 100644 --- a/localstack/aws/handlers/logging.py +++ b/localstack/aws/handlers/logging.py @@ -98,6 +98,9 @@ def _log(self, context: RequestContext, response: Response): response.status_code, context.service_exception.code, extra={ + # context + "account_id": context.account_id, + "region": context.region, # request "input_type": context.operation.input_shape.name if context.operation.input_shape @@ -117,6 +120,9 @@ def _log(self, context: RequestContext, response: Response): context.operation.name, response.status_code, extra={ + # context + "account_id": context.account_id, + "region": context.region, # request "input_type": context.operation.input_shape.name if context.operation.input_shape diff --git a/localstack/logging/format.py b/localstack/logging/format.py index 7cd8fa74e3e10..e27d35758e3d3 100644 --- a/localstack/logging/format.py +++ b/localstack/logging/format.py @@ -107,8 +107,9 @@ def compress_logger_name(name: str, length: int) -> str: class TraceLoggingFormatter(logging.Formatter): aws_trace_log_format = ( - LOG_FORMAT - + "; %(input_type)s(%(input)s, headers=%(request_headers)s); %(output_type)s(%(output)s, headers=%(response_headers)s)" + LOG_FORMAT + "; %(account_id)s/%(region)s; " + "%(input_type)s(%(input)s, headers=%(request_headers)s); " + "%(output_type)s(%(output)s, headers=%(response_headers)s)" ) def __init__(self):